Skip to content

Commit

Permalink
Return nil backup summary for backup with no pods
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek committed Nov 29, 2024
1 parent d5607c6 commit d9b53f5
Showing 1 changed file with 33 additions and 28 deletions.
61 changes: 33 additions & 28 deletions controllers/medusa/medusabackupjob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,35 +433,40 @@ func (c *fakeMedusaClient) GetBackups(ctx context.Context) ([]*medusa.BackupSumm
status = *medusa.StatusType_IN_PROGRESS.Enum()
}

backup := &medusa.BackupSummary{
BackupName: name,
StartTime: 0,
FinishTime: 10,
TotalNodes: 3,
FinishedNodes: 3,
TotalObjects: fakeBackupFileCount,
TotalSize: fakeBackupByteSize,
Status: status,
Nodes: []*medusa.BackupNode{
{
Host: "host1",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
},
{
Host: "host2",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
},
{
Host: "host3",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
var backup *medusa.BackupSummary
if strings.HasPrefix(name, backupWithNoPods) {
backup = nil
} else {
backup = &medusa.BackupSummary{
BackupName: name,
StartTime: 0,
FinishTime: 10,
TotalNodes: 3,
FinishedNodes: 3,
TotalObjects: fakeBackupFileCount,
TotalSize: fakeBackupByteSize,
Status: status,
Nodes: []*medusa.BackupNode{
{
Host: "host1",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
},
{
Host: "host2",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
},
{
Host: "host3",
Tokens: []int64{1, 2, 3},
Datacenter: "dc1",
Rack: "rack1",
},
},
},
}
}
backups = append(backups, backup)
}
Expand Down

0 comments on commit d9b53f5

Please sign in to comment.