Exemplo n.º 1
0
func (s *migrateLocalProviderAgentConfigSuite) TestIdempotent(c *gc.C) {
	s.primeConfig(c, s.State, state.JobManageEnviron, names.NewMachineTag("0"))
	err := upgrades.MigrateLocalProviderAgentConfig(s.ctx)
	c.Assert(err, jc.ErrorIsNil)
	err = s.config.Write()
	c.Assert(err, jc.ErrorIsNil)
	s.assertConfigProcessed(c)

	err = upgrades.MigrateLocalProviderAgentConfig(s.ctx)
	c.Assert(err, jc.ErrorIsNil)
	err = s.config.Write()
	c.Assert(err, jc.ErrorIsNil)
	s.assertConfigProcessed(c)
}
Exemplo n.º 2
0
func (s *migrateLocalProviderAgentConfigSuite) TestMigrateWithoutStateConnectionNotDone(c *gc.C) {
	s.primeConfig(c, nil, state.JobManageEnviron, names.NewMachineTag("0"))
	err := upgrades.MigrateLocalProviderAgentConfig(s.ctx)
	c.Assert(err, jc.ErrorIsNil)
	err = s.config.Write()
	c.Assert(err, jc.ErrorIsNil)
	s.assertConfigNotProcessed(c)
}
Exemplo n.º 3
0
func (s *migrateLocalProviderAgentConfigSuite) TestMigrateStateServer(c *gc.C) {
	s.primeConfig(c, s.State, state.JobManageEnviron, "machine-0")
	err := upgrades.MigrateLocalProviderAgentConfig(s.ctx)
	c.Assert(err, gc.IsNil)
	err = s.config.Write()
	c.Assert(err, gc.IsNil)
	s.assertConfigProcessed(c)
}
Exemplo n.º 4
0
func (s *migrateLocalProviderAgentConfigSuite) TestMigrateNonLocalEnvNotDone(c *gc.C) {
	s.PatchValue(upgrades.IsLocalEnviron, func(_ *config.Config) bool { return false })
	s.primeConfig(c, s.State, state.JobManageEnviron, names.NewMachineTag("0"))
	err := upgrades.MigrateLocalProviderAgentConfig(s.ctx)
	c.Assert(err, jc.ErrorIsNil)
	err = s.config.Write()
	c.Assert(err, jc.ErrorIsNil)
	s.assertConfigNotProcessed(c)
}