Skip to content

Commit c2489d8

Browse files
committed
Add test for creation timestamp of fix #46
1 parent d629f0c commit c2489d8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

upcloud/service/service_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,16 @@ func TestCreateBackup(t *testing.T) {
409409

410410
// Create a backup
411411
t.Logf("Creating backup of storage with UUID %s ...", storageDetails.UUID)
412+
timeBeforeBackup := time.Now()
413+
412414
backupDetails, err := svc.CreateBackup(&request.CreateBackupRequest{
413415
UUID: storageDetails.UUID,
414416
Title: "Backup",
415417
})
416418

417419
handleError(err)
418420
waitForStorageOnline(storageDetails.UUID)
421+
timeAfterBackup := time.Now()
419422
t.Logf("Created backup with UUID %s", backupDetails.UUID)
420423

421424
// Get backup storage details
@@ -430,6 +433,14 @@ func TestCreateBackup(t *testing.T) {
430433
t.Errorf("The origin UUID %s of backup storage UUID %s does not match the actual origina UUID %s", backupStorageDetails.Origin, backupDetails.UUID, storageDetails.UUID)
431434
}
432435

436+
if backupStorageDetails.Created.Before(timeBeforeBackup) {
437+
t.Errorf("The creation timestamp of backup storage UUID %s is too early", backupDetails.UUID)
438+
}
439+
440+
if backupStorageDetails.Created.After(timeAfterBackup) {
441+
t.Errorf("The creation timestamp of backup storage UUID %s is too late", backupDetails.UUID)
442+
}
443+
433444
t.Logf("Backup storage origin UUID OK")
434445
}
435446

0 commit comments

Comments
 (0)