~rogpeppe/juju-core/themue-058-debug-log-api

« back to all changes in this revision

Viewing changes to environs/config/config_test.go

  • Committer: Frank Mueller
  • Date: 2014-01-23 14:14:49 UTC
  • mfrom: (2152.1.95 juju-core)
  • Revision ID: frank.mueller@canonical.com-20140123141449-b30l57y7gs3wjkpw
debugger: merged trunk and fixed permission and interface problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
func (s *ConfigSuite) SetUpTest(c *gc.C) {
37
37
        s.LoggingSuite.SetUpTest(c)
 
38
        // Make sure that the defaults are used, which
 
39
        // is <root>=WARNING
38
40
        loggo.ResetLoggers()
39
41
}
40
42
 
838
840
                c.Assert(cfg.ProvisionerSafeMode(), gc.Equals, false)
839
841
        }
840
842
 
841
 
        if v, ok := test.attrs["logging-config"]; ok {
842
 
                c.Assert(cfg.LoggingConfig(), gc.Equals, v)
843
 
        } else {
844
 
                c.Assert(cfg.LoggingConfig(), gc.Equals, "<root>=DEBUG")
845
 
        }
846
 
 
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)
873
869
 
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()
1076
1071
 
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")
 
1075
}
 
1076
 
 
1077
func (*ConfigSuite) TestLoggingConfigWithUnit(c *gc.C) {
 
1078
        defer makeFakeHome(c).Restore()
 
1079
 
 
1080
        config := newTestConfig(c, testing.Attrs{
 
1081
                "logging-config": "<root>=WARNING;unit=INFO"})
 
1082
        c.Assert(config.LoggingConfig(), gc.Equals, "<root>=WARNING;unit=INFO")
1080
1083
}
1081
1084
 
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")
1086
1088
 
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")
1089
1091
}
1090
1092
 
1091
1093
func (*ConfigSuite) TestProxyValuesWithFallback(c *gc.C) {