func (s *ManifoldSuite) TestMachineNonManagerErrors(c *gc.C) { config := resumer.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig()) _, err := workertesting.RunPostUpgradeManifold( resumer.Manifold(config), &fakeAgent{tag: names.NewMachineTag("42")}, &fakeAPIConn{machineJob: multiwatcher.JobHostUnits}) c.Assert(err, gc.Equals, dependency.ErrMissing) c.Assert(s.newCalled, jc.IsFalse) }
func (s *ManifoldSuite) TestNonAgentErrors(c *gc.C) { config := resumer.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig()) _, err := workertesting.RunPostUpgradeManifold( resumer.Manifold(config), &fakeAgent{tag: names.NewUserTag("foo")}, &fakeAPIConn{}) c.Assert(err, gc.ErrorMatches, "this manifold may only be used inside a machine agent") c.Assert(s.newCalled, jc.IsFalse) }
func (s *ManifoldSuite) TestMachine(c *gc.C) { config := resumer.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig()) _, err := workertesting.RunPostUpgradeManifold( resumer.Manifold(config), &fakeAgent{tag: names.NewMachineTag("42")}, &fakeAPIConn{machineJob: multiwatcher.JobManageModel}) c.Assert(err, jc.ErrorIsNil) c.Assert(s.newCalled, jc.IsTrue) }