Fix unit test
This commit is contained in:
parent
2d627d832a
commit
eaf1429d19
@ -371,7 +371,7 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
|||||||
|
|
||||||
backupWithLegacyResource := func(protectedResource string, b *backup.Backup) *backup.Backup {
|
backupWithLegacyResource := func(protectedResource string, b *backup.Backup) *backup.Backup {
|
||||||
res := *b
|
res := *b
|
||||||
res.ResourceOwnerID = protectedResource
|
res.ProtectedResourceID = protectedResource
|
||||||
|
|
||||||
return &res
|
return &res
|
||||||
}
|
}
|
||||||
@ -706,15 +706,14 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Test that an assist base that has the same Reasons as a newer merge
|
// Test that an assist base that has the same Reasons as a newer merge
|
||||||
// base but the merge base is from an older version of corso for some
|
// base but the merge base is missing the protected resource ID for some
|
||||||
// reason doesn't cause the assist base to be garbage collected. This is
|
// reason doesn't cause the assist base to be garbage collected. This is
|
||||||
// not ideal, but some older versions of corso didn't even populate the
|
// not ideal, but at least we're not accidentally removing assist bases
|
||||||
// resource owner ID.
|
// that could be useful later on.
|
||||||
//
|
//
|
||||||
// Worst case, the assist base will be cleaned up when the user upgrades
|
// Worst case, the assist base will be cleaned up when there's a merge
|
||||||
// corso and generates either a new assist base or merge base with the
|
// base that does populated the protected resource ID field.
|
||||||
// same reason.
|
name: "AssistAndMergeMissingResourceIDBases NotYoungest Noops",
|
||||||
name: "AssistAndLegacyMergeBases NotYoungest Noops",
|
|
||||||
snapshots: []*manifest.EntryMetadata{
|
snapshots: []*manifest.EntryMetadata{
|
||||||
manifestWithReasons(
|
manifestWithReasons(
|
||||||
manifestWithTime(baseTime, snapCurrent()),
|
manifestWithTime(baseTime, snapCurrent()),
|
||||||
@ -730,7 +729,15 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
|||||||
},
|
},
|
||||||
backups: []backupRes{
|
backups: []backupRes{
|
||||||
{bup: backupWithResource("ro", true, backupWithTime(baseTime, bupCurrent()))},
|
{bup: backupWithResource("ro", true, backupWithTime(baseTime, bupCurrent()))},
|
||||||
{bup: backupWithLegacyResource("ro", backupWithTime(baseTime.Add(time.Second), bupCurrent2()))},
|
{bup: func() *backup.Backup {
|
||||||
|
res := backupWithResource(
|
||||||
|
"ro",
|
||||||
|
false,
|
||||||
|
backupWithTime(baseTime.Add(time.Second), bupCurrent2()))
|
||||||
|
res.ProtectedResourceID = ""
|
||||||
|
|
||||||
|
return res
|
||||||
|
}()},
|
||||||
},
|
},
|
||||||
time: baseTime.Add(48 * time.Hour),
|
time: baseTime.Add(48 * time.Hour),
|
||||||
buffer: 24 * time.Hour,
|
buffer: 24 * time.Hour,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user