Exemple #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())
}
Exemple #2
0
func (s *storageSuite) TestSetBackupStoredTimeNotFound(c *gc.C) {
	stored := time.Now()
	err := backups.SetBackupStoredTime(s.State, "spam", stored)

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