Minor fixups for base finding (#3617)

Fix:
  * return errors when told to
  * fixup timestamp issues

---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

* #3525

#### Test Plan

- [x] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-06-14 11:04:03 -07:00 committed by GitHub
parent 271c0ef0a3
commit 8996d3edab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,6 +230,10 @@ func (msm *mockSnapshotManager) LoadSnapshot(
for _, mi := range msm.data { for _, mi := range msm.data {
if mi.man.ID == id { if mi.man.ID == id {
if mi.err != nil {
return nil, mi.err
}
return mi.man, nil return mi.man, nil
} }
} }
@ -259,10 +263,12 @@ func newBackupModel(
err: err, err: err,
} }
if !oldDetailsID { if hasDetailsSnap {
res.b.StreamStoreID = "ssid" if !oldDetailsID {
} else { res.b.StreamStoreID = "ssid"
res.b.DetailsID = "ssid" } else {
res.b.DetailsID = "ssid"
}
} }
return res return res
@ -393,14 +399,14 @@ func (suite *BaseFinderUnitSuite) TestGetBases() {
), ),
}, },
expectedBaseReasons: map[int][]Reason{ expectedBaseReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
expectedAssistManifestReasons: map[int][]Reason{ expectedAssistManifestReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
backupData: []backupInfo{ backupData: []backupInfo{
newBackupModel(testBackup2, true, true, false, nil), newBackupModel(testBackup2, true, true, false, nil),
newBackupModel(testBackup1, false, false, false, assert.AnError), newBackupModel(testBackup1, true, true, false, nil),
}, },
}, },
{ {
@ -427,14 +433,14 @@ func (suite *BaseFinderUnitSuite) TestGetBases() {
), ),
}, },
expectedBaseReasons: map[int][]Reason{ expectedBaseReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
expectedAssistManifestReasons: map[int][]Reason{ expectedAssistManifestReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
backupData: []backupInfo{ backupData: []backupInfo{
newBackupModel(testBackup2, true, true, false, nil), newBackupModel(testBackup2, false, false, false, assert.AnError),
newBackupModel(testBackup1, false, false, false, assert.AnError), newBackupModel(testBackup1, true, true, false, nil),
}, },
}, },
{ {
@ -461,14 +467,14 @@ func (suite *BaseFinderUnitSuite) TestGetBases() {
), ),
}, },
expectedBaseReasons: map[int][]Reason{ expectedBaseReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
expectedAssistManifestReasons: map[int][]Reason{ expectedAssistManifestReasons: map[int][]Reason{
0: testUser1Mail, 1: testUser1Mail,
}, },
backupData: []backupInfo{ backupData: []backupInfo{
newBackupModel(testBackup2, true, true, false, nil), newBackupModel(testBackup2, true, false, false, nil),
newBackupModel(testBackup1, true, false, false, nil), newBackupModel(testBackup1, true, true, false, nil),
}, },
}, },
{ {