示例#1
0
func (s *storageSuite) TestSetBackupStoredTimeSuccess(c *gc.C) {
	stored := time.Now()
	original := s.metadata(c)
	id, err := backups.AddBackupMetadata(s.State, original)
	c.Assert(err, jc.ErrorIsNil)
	meta, err := backups.GetBackupMetadata(s.State, id)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(meta.Stored(), gc.IsNil)

	err = backups.SetBackupStoredTime(s.State, id, stored)
	c.Assert(err, jc.ErrorIsNil)

	meta, err = backups.GetBackupMetadata(s.State, id)
	c.Assert(err, jc.ErrorIsNil)
	c.Check(meta.Stored().Unix(), gc.Equals, stored.UTC().Unix())
}
示例#2
0
func (s *storageSuite) TestGetBackupMetadataFound(c *gc.C) {
	original := s.metadata(c)
	id, err := backups.AddBackupMetadata(s.State, original)
	c.Assert(err, jc.ErrorIsNil)

	meta, err := backups.GetBackupMetadata(s.State, id)
	c.Assert(err, jc.ErrorIsNil)

	s.checkMeta(c, meta, original, id)
}
示例#3
0
func (s *storageSuite) TestGetBackupMetadataNotFound(c *gc.C) {
	_, err := backups.GetBackupMetadata(s.State, "spam")

	c.Check(err, jc.Satisfies, errors.IsNotFound)
}