Пример #1
0
func (s *BlockDevicesSuite) TestSetMachineBlockDevicesUnchanged(c *gc.C) {
	sda := state.BlockDeviceInfo{DeviceName: "sda"}
	err := s.machine.SetMachineBlockDevices(sda)
	c.Assert(err, jc.ErrorIsNil)
	s.assertBlockDevices(c, s.machine.MachineTag(), []state.BlockDeviceInfo{sda})

	// Setting the same should not change txn-revno.
	docID := state.DocID(s.State, s.machine.Id())
	before, err := state.TxnRevno(s.State, state.BlockDevicesC, docID)
	c.Assert(err, jc.ErrorIsNil)

	err = s.machine.SetMachineBlockDevices(sda)
	c.Assert(err, jc.ErrorIsNil)

	after, err := state.TxnRevno(s.State, state.BlockDevicesC, docID)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(after, gc.Equals, before)
}
Пример #2
0
func (s *StorageStateSuite) storageInstanceExists(c *gc.C, tag names.StorageTag) bool {
	_, err := state.TxnRevno(
		s.State,
		state.StorageInstancesC,
		state.DocID(s.State, tag.Id()),
	)
	if err != nil {
		c.Assert(err, gc.Equals, mgo.ErrNotFound)
		return false
	}
	return true
}