838
840
c.Assert(cfg.ProvisionerSafeMode(), gc.Equals, false)
841
if v, ok := test.attrs["logging-config"]; ok {
842
c.Assert(cfg.LoggingConfig(), gc.Equals, v)
844
c.Assert(cfg.LoggingConfig(), gc.Equals, "<root>=DEBUG")
847
843
url, urlPresent := cfg.ImageMetadataURL()
848
844
if v, _ := test.attrs["image-metadata-url"].(string); v != "" {
849
845
c.Assert(url, gc.Equals, v)
874
870
func (s *ConfigSuite) TestConfigAttrs(c *gc.C) {
875
871
// Normally this is handled by testing.FakeHome
876
s.PatchEnvironment(osenv.JujuLoggingConfig, "")
872
s.PatchEnvironment(osenv.JujuLoggingConfigEnvKey, "")
877
873
attrs := map[string]interface{}{
878
874
"type": "my-type",
879
875
"name": "my-name",
897
893
// These attributes are added if not set.
898
894
attrs["development"] = false
899
895
attrs["default-series"] = config.DefaultSeries
900
attrs["logging-config"] = loggo.LoggerInfo()
896
attrs["logging-config"] = "<root>=WARNING;unit=DEBUG"
901
897
attrs["ca-private-key"] = ""
902
898
attrs["image-metadata-url"] = ""
903
899
attrs["tools-metadata-url"] = ""
904
900
attrs["tools-url"] = ""
905
attrs["logging-config"] = "<root>=DEBUG"
906
901
// Default firewall mode is instance
907
902
attrs["firewall-mode"] = string(config.FwInstance)
908
903
c.Assert(cfg.AllAttrs(), gc.DeepEquals, attrs)
1074
1069
func (*ConfigSuite) TestLoggingConfig(c *gc.C) {
1075
1070
defer makeFakeHome(c).Restore()
1077
logConfig := "<root>=WARNING;juju=DEBUG"
1078
config := newTestConfig(c, testing.Attrs{"logging-config": logConfig})
1079
c.Assert(config.LoggingConfig(), gc.Equals, logConfig)
1072
config := newTestConfig(c, testing.Attrs{
1073
"logging-config": "<root>=WARNING;juju=DEBUG"})
1074
c.Assert(config.LoggingConfig(), gc.Equals, "<root>=WARNING;juju=DEBUG;unit=DEBUG")
1077
func (*ConfigSuite) TestLoggingConfigWithUnit(c *gc.C) {
1078
defer makeFakeHome(c).Restore()
1080
config := newTestConfig(c, testing.Attrs{
1081
"logging-config": "<root>=WARNING;unit=INFO"})
1082
c.Assert(config.LoggingConfig(), gc.Equals, "<root>=WARNING;unit=INFO")
1082
1085
func (s *ConfigSuite) TestLoggingConfigFromEnvironment(c *gc.C) {
1083
1086
defer makeFakeHome(c).Restore()
1084
logConfig := "<root>=INFO"
1085
s.PatchEnvironment(osenv.JujuLoggingConfig, logConfig)
1087
s.PatchEnvironment(osenv.JujuLoggingConfigEnvKey, "<root>=INFO")
1087
1089
config := newTestConfig(c, nil)
1088
c.Assert(config.LoggingConfig(), gc.Equals, logConfig)
1090
c.Assert(config.LoggingConfig(), gc.Equals, "<root>=INFO;unit=DEBUG")
1091
1093
func (*ConfigSuite) TestProxyValuesWithFallback(c *gc.C) {