Esempio n. 1
0
func (s *ManifoldSuite) TestUnit(c *gc.C) {
	config := proxyup.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig())
	_, err := workertesting.RunPostUpgradeManifold(
		proxyup.Manifold(config),
		&fakeAgent{tag: names.NewUnitTag("foo/0")},
		nil)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
Esempio n. 2
0
func (s *ManifoldSuite) TestNonAgent(c *gc.C) {
	config := proxyup.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig())
	_, err := workertesting.RunPostUpgradeManifold(
		proxyup.Manifold(config),
		&fakeAgent{tag: names.NewUserTag("foo")},
		nil)
	c.Assert(err, gc.ErrorMatches, "unknown agent type:.+")
	c.Assert(s.newCalled, jc.IsFalse)
}
Esempio n. 3
0
func (s *ManifoldSuite) TestMachineNotModelManagerErrors(c *gc.C) {
	config := identityfilewriter.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig())
	_, err := workertesting.RunPostUpgradeManifold(
		identityfilewriter.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		mockAPICaller(multiwatcher.JobHostUnits))
	c.Assert(err, gc.Equals, dependency.ErrMissing)
	c.Assert(s.newCalled, jc.IsFalse)
}
Esempio n. 4
0
func (s *ManifoldSuite) TestNonMachineAgent(c *gc.C) {
	config := identityfilewriter.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig())
	_, err := workertesting.RunPostUpgradeManifold(
		identityfilewriter.Manifold(config),
		&fakeAgent{tag: names.NewUnitTag("foo/0")},
		mockAPICaller(""))
	c.Assert(err, gc.ErrorMatches, "this manifold may only be used inside a machine agent")
	c.Assert(s.newCalled, jc.IsFalse)
}
Esempio n. 5
0
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)
}
Esempio n. 6
0
func (s *ManifoldSuite) TestMachine(c *gc.C) {
	config := identityfilewriter.ManifoldConfig(workertesting.PostUpgradeManifoldTestConfig())
	_, err := workertesting.RunPostUpgradeManifold(
		identityfilewriter.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		mockAPICaller(multiwatcher.JobManageModel))
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
Esempio n. 7
0
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)
}
Esempio n. 8
0
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)
}
func (s *MachineManifoldSuite) TestNonAgent(c *gc.C) {
	config := storageprovisioner.MachineManifoldConfig{
		PostUpgradeManifoldConfig: workertesting.PostUpgradeManifoldTestConfig(),
		Clock: coretesting.NewClock(defaultClockStart),
	}
	_, err := workertesting.RunPostUpgradeManifold(
		storageprovisioner.MachineManifold(config),
		&fakeAgent{tag: names.NewUserTag("foo")},
		&fakeAPIConn{})
	c.Assert(err, gc.ErrorMatches, "expected ModelTag or MachineTag, got names.UserTag")
	c.Assert(s.newCalled, jc.IsFalse)
}
Esempio n. 10
0
func (s *MachineManifoldSuite) TestMissingClock(c *gc.C) {
	config := storageprovisioner.MachineManifoldConfig{
		PostUpgradeManifoldConfig: workertesting.PostUpgradeManifoldTestConfig(),
		// Clock: coretesting.NewClock(defaultClockStart),
	}
	_, err := workertesting.RunPostUpgradeManifold(
		storageprovisioner.MachineManifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		&fakeAPIConn{})
	c.Assert(err, gc.Equals, dependency.ErrMissing)
	c.Assert(s.newCalled, jc.IsFalse)
}
Esempio n. 11
0
func (s *MachineManifoldSuite) TestMachine(c *gc.C) {
	config := storageprovisioner.MachineManifoldConfig{
		PostUpgradeManifoldConfig: workertesting.PostUpgradeManifoldTestConfig(),
		Clock: coretesting.NewClock(defaultClockStart),
	}
	_, err := workertesting.RunPostUpgradeManifold(
		storageprovisioner.MachineManifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		&fakeAPIConn{})
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}