func (s *syslogConfigSuite) TestAccumulateConfigRender(c *gc.C) { syslogConfigRenderer := syslog.NewAccumulateConfig("some-machine", agent.DefaultLogDir, 8888, "", []string{"foo"}) s.assertRsyslogConfigContents( c, syslogConfigRenderer, syslogtesting.ExpectedAccumulateSyslogConf(c, "some-machine", "", 8888), ) }
func (s *syslogConfigSuite) TestAccumulateConfigRender(c *gc.C) { cfg := cfg() syslog.NewAccumulateConfig(cfg) s.assertRsyslogConfigContents( c, cfg, syslogtesting.ExpectedAccumulateSyslogConf(c, args()), ) }
func (s *syslogConfigSuite) TestAccumulateConfigRenderWithNamespace(c *gc.C) { cfg := cfg() cfg.Namespace = "namespace" cfg.JujuConfigDir = cfg.JujuConfigDir + "-" + cfg.Namespace cfg.LogDir = cfg.LogDir + "-" + cfg.Namespace args := args() args.Namespace = "namespace" syslog.NewAccumulateConfig(cfg) s.assertRsyslogConfigContents( c, cfg, syslogtesting.ExpectedAccumulateSyslogConf(c, args), ) }
func (s *syslogConfigSuite) TestAccumulateConfigWrite(c *gc.C) { syslogConfigRenderer := syslog.NewAccumulateConfig("some-machine", agent.DefaultLogDir, 8888, "", []string{"foo"}) syslogConfigRenderer.ConfigDir = s.configDir syslogConfigRenderer.ConfigFileName = "rsyslog.conf" s.assertRsyslogConfigPath(c, syslogConfigRenderer) err := syslogConfigRenderer.Write() c.Assert(err, gc.IsNil) syslogConfData, err := ioutil.ReadFile(syslogConfigRenderer.ConfigFilePath()) c.Assert(err, gc.IsNil) c.Assert( string(syslogConfData), gc.Equals, syslogtesting.ExpectedAccumulateSyslogConf(c, "some-machine", "", 8888), ) }
func (s *syslogConfigSuite) TestAccumulateConfigWrite(c *gc.C) { syslogConfigRenderer := cfg() syslog.NewAccumulateConfig(syslogConfigRenderer) syslogConfigRenderer.ConfigDir = s.configDir syslogConfigRenderer.ConfigFileName = "rsyslog.conf" s.assertRsyslogConfigPath(c, syslogConfigRenderer) err := syslogConfigRenderer.Write() c.Assert(err, jc.ErrorIsNil) syslogConfData, err := ioutil.ReadFile(syslogConfigRenderer.ConfigFilePath()) c.Assert(err, jc.ErrorIsNil) c.Assert( string(syslogConfData), gc.Equals, syslogtesting.ExpectedAccumulateSyslogConf(c, args()), ) }