コード例 #1
0
ファイル: manifold_machine_test.go プロジェクト: makyo/juju
func (s *MachineManifoldSuite) TestNonAgent(c *gc.C) {
	_, err := workertesting.RunAgentApiManifold(
		storageprovisioner.MachineManifold(s.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)
}
コード例 #2
0
ファイル: manifold_machine_test.go プロジェクト: makyo/juju
func (s *MachineManifoldSuite) TestMachine(c *gc.C) {
	_, err := workertesting.RunAgentApiManifold(
		storageprovisioner.MachineManifold(s.config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		&fakeAPIConn{})
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
コード例 #3
0
ファイル: manifold_machine_test.go プロジェクト: makyo/juju
func (s *MachineManifoldSuite) TestMissingClock(c *gc.C) {
	s.config.Clock = nil
	_, err := workertesting.RunAgentApiManifold(
		storageprovisioner.MachineManifold(s.config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		&fakeAPIConn{})
	c.Assert(err, gc.Equals, dependency.ErrMissing)
	c.Assert(s.newCalled, jc.IsFalse)
}
コード例 #4
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestMachineNotModelManagerErrors(c *gc.C) {
	config := toolsversionchecker.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		toolsversionchecker.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		mockAPICaller(multiwatcher.JobHostUnits))
	c.Assert(err, gc.Equals, dependency.ErrMissing)
	c.Assert(s.newCalled, jc.IsFalse)
}
コード例 #5
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestNonMachineAgent(c *gc.C) {
	config := toolsversionchecker.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		toolsversionchecker.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)
}
コード例 #6
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestNonAgentErrors(c *gc.C) {
	config := resumer.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		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)
}
コード例 #7
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestMachine(c *gc.C) {
	config := toolsversionchecker.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		toolsversionchecker.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		mockAPICaller(multiwatcher.JobManageModel))
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
コード例 #8
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestMachineNonManagerErrors(c *gc.C) {
	config := resumer.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		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)
}
コード例 #9
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestMachine(c *gc.C) {
	config := resumer.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		resumer.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		&fakeAPIConn{machineJob: multiwatcher.JobManageModel})
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
コード例 #10
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestNonAgent(c *gc.C) {
	config := proxyup.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		proxyup.Manifold(config),
		&fakeAgent{tag: names.NewUserTag("foo")},
		nil)
	c.Assert(err, gc.ErrorMatches, "unknown agent type:.+")
	c.Assert(s.newCalled, jc.IsFalse)
}
コード例 #11
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestUnit(c *gc.C) {
	config := proxyup.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		proxyup.Manifold(config),
		&fakeAgent{tag: names.NewUnitTag("foo/0")},
		nil)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}
コード例 #12
0
ファイル: manifold_test.go プロジェクト: makyo/juju
func (s *ManifoldSuite) TestMachineShouldntWrite(c *gc.C) {
	config := proxyup.ManifoldConfig(workertesting.AgentApiManifoldTestConfig())
	_, err := workertesting.RunAgentApiManifold(
		proxyup.Manifold(config),
		&fakeAgent{tag: names.NewMachineTag("42")},
		nil)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(s.newCalled, jc.IsTrue)
}