Пример #1
0
func (s *ConfigDeprecationSuite) checkDeprecationWarning(c *gc.C, attrs testing.Attrs, expectedMsg string) {
	content := `
environments:
    deprecated:
        type: dummy
        state-server: false
`
	restore := s.setupLogger(c)
	defer restore()

	envs, err := environs.ReadEnvironsBytes([]byte(content))
	c.Check(err, gc.IsNil)
	environs.UpdateEnvironAttrs(envs, "deprecated", attrs)
	_, err = envs.Config("deprecated")
	c.Check(err, gc.IsNil)
	c.Assert(s.writer.Log, gc.HasLen, 1)
	stripped := strings.Replace(s.writer.Log[0].Message, "\n", "", -1)
	c.Assert(stripped, gc.Matches, expectedMsg)
}
Пример #2
0
func (s *ConfigDeprecationSuite) checkDeprecationWarning(c *gc.C, attrs testing.Attrs, expectedMsg string) {
	content := `
environments:
    deprecated:
        type: dummy
        controller: false
`
	restore := s.setupLogger(c)
	defer restore()

	envs, err := environs.ReadEnvironsBytes([]byte(content))
	c.Assert(err, jc.ErrorIsNil)
	environs.UpdateEnvironAttrs(envs, "deprecated", attrs)
	_, err = envs.Config("deprecated")
	c.Assert(err, jc.ErrorIsNil)

	var stripped string
	if log := s.writer.Log(); len(log) == 1 {
		stripped = strings.Replace(log[0].Message, "\n", "", -1)
	}

	c.Check(stripped, gc.Matches, expectedMsg)
}