Beispiel #1
0
func (s *retryProvisioningSuite) TestBlockRetryProvisioning(c *gc.C) {
	s.fake.err = common.OperationBlockedError("TestBlockRetryProvisioning")
	command := model.NewRetryProvisioningCommandForTest(s.fake)

	for i, t := range resolvedMachineTests {
		c.Logf("test %d: %v", i, t.args)
		_, err := testing.RunCommand(c, command, t.args...)
		if t.err != "" {
			c.Check(err, gc.ErrorMatches, t.err)
			continue
		}
		testing.AssertOperationWasBlocked(c, err, ".*TestBlockRetryProvisioning.*")
	}
}
Beispiel #2
0
func (s *retryProvisioningSuite) TestBlockRetryProvisioning(c *gc.C) {
	s.fake.err = common.OperationBlockedError("TestBlockRetryProvisioning")
	command := model.NewRetryProvisioningCommandForTest(s.fake)

	for i, t := range resolvedMachineTests {
		c.Logf("test %d: %v", i, t.args)
		_, err := testing.RunCommand(c, command, t.args...)
		if t.err != "" {
			c.Check(err, gc.ErrorMatches, t.err)
			continue
		}
		c.Assert(err, gc.ErrorMatches, cmd.ErrSilent.Error())
		// msg is logged
		stripped := strings.Replace(c.GetTestLog(), "\n", "", -1)
		c.Check(stripped, gc.Matches, ".*TestBlockRetryProvisioning.*")
	}
}
Beispiel #3
0
func (s *retryProvisioningSuite) TestRetryProvisioning(c *gc.C) {
	for i, t := range resolvedMachineTests {
		c.Logf("test %d: %v", i, t.args)
		command := model.NewRetryProvisioningCommandForTest(s.fake)
		context, err := testing.RunCommand(c, command, t.args...)
		if t.err != "" {
			c.Check(err, gc.ErrorMatches, t.err)
			continue
		}
		c.Check(err, jc.ErrorIsNil)
		output := testing.Stderr(context)
		stripped := strings.Replace(output, "\n", "", -1)
		c.Check(stripped, gc.Equals, t.stdErr)
		if t.args[0] == "0" {
			m := s.fake.m["0"]
			c.Check(m.info, gc.Equals, "broken")
			c.Check(m.data["transient"], jc.IsTrue)
		}
	}
}