Skip to content

Commit

Permalink
testing: fix TestUploadDownloadExtended
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Feb 15, 2024
1 parent 3f6dad7 commit 2c627d9
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions internal/testing/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,30 +697,33 @@ func TestUploadDownloadExtended(t *testing.T) {
}

// check objects stats.
for _, opts := range []api.ObjectsStatsOpts{
{}, // any bucket
{Bucket: api.DefaultBucketName}, // specific bucket
} {
info, err := cluster.Bus.ObjectsStats(context.Background(), opts)
tt.OK(err)
objectsSize := uint64(len(file1) + len(file2) + len(small) + len(large))
if info.TotalObjectsSize != objectsSize {
t.Error("wrong size", info.TotalObjectsSize, objectsSize)
}
sectorsSize := 15 * rhpv2.SectorSize
if info.TotalSectorsSize != uint64(sectorsSize) {
t.Error("wrong size", info.TotalSectorsSize, sectorsSize)
}
if info.TotalUploadedSize != uint64(sectorsSize) {
t.Error("wrong size", info.TotalUploadedSize, sectorsSize)
}
if info.NumObjects != 4 {
t.Error("wrong number of objects", info.NumObjects, 4)
}
if info.MinHealth != 1 {
t.Errorf("expected minHealth of 1, got %v", info.MinHealth)
tt.Retry(100, 100*time.Millisecond, func() error {
for _, opts := range []api.ObjectsStatsOpts{
{}, // any bucket
{Bucket: api.DefaultBucketName}, // specific bucket
} {
info, err := cluster.Bus.ObjectsStats(context.Background(), opts)
tt.OK(err)
objectsSize := uint64(len(file1) + len(file2) + len(small) + len(large))
if info.TotalObjectsSize != objectsSize {
return fmt.Errorf("wrong size %v %v", info.TotalObjectsSize, objectsSize)
}
sectorsSize := 15 * rhpv2.SectorSize
if info.TotalSectorsSize != uint64(sectorsSize) {
return fmt.Errorf("wrong size %v %v", info.TotalSectorsSize, sectorsSize)
}
if info.TotalUploadedSize != uint64(sectorsSize) {
return fmt.Errorf("wrong size %v %v", info.TotalUploadedSize, sectorsSize)
}
if info.NumObjects != 4 {
return fmt.Errorf("wrong number of objects %v %v", info.NumObjects, 4)
}
if info.MinHealth != 1 {
return fmt.Errorf("expected minHealth of 1, got %v", info.MinHealth)
}
}
}
return nil
})

// download the data
for _, data := range [][]byte{small, large} {
Expand Down

0 comments on commit 2c627d9

Please sign in to comment.