cmd/objbench: fix the mtime check log of the list results (#6490)

This commit is contained in:
zhijian
2025-11-26 09:47:40 +08:00
committed by GitHub
parent 44a2512fa8
commit 639ed97d3d
2 changed files with 4 additions and 4 deletions

View File

@@ -908,7 +908,7 @@ func functionalTesting(ctx context.Context, blob object.ObjectStorage, result *[
}
now := time.Now()
if objs[1].Mtime().Before(now.Add(-30*time.Second)) || objs[1].Mtime().After(now.Add(time.Second*30)) {
return fmt.Errorf("mtime of key should be within 10 seconds, but got %s", objs[1].Mtime().Sub(now))
return fmt.Errorf("mtime of key should be within 30 seconds, but got %s", objs[1].Mtime().Sub(now))
}
} else {
return fmt.Errorf("list failed: %s", err)
@@ -934,7 +934,7 @@ func functionalTesting(ctx context.Context, blob object.ObjectStorage, result *[
}
now := time.Now()
if objs[0].Mtime().Before(now.Add(-30*time.Second)) || objs[0].Mtime().After(now.Add(time.Second*30)) {
return fmt.Errorf("mtime of key should be within 10 seconds, but got %s", objs[0].Mtime().Sub(now))
return fmt.Errorf("mtime of key should be within 30 seconds, but got %s", objs[0].Mtime().Sub(now))
}
} else {
return fmt.Errorf("list failed: %s", err2)

View File

@@ -217,7 +217,7 @@ func testStorage(t *testing.T, s ObjectStorage) {
}
now := time.Now()
if objs[1].Mtime().Before(now.Add(-30*time.Second)) || objs[1].Mtime().After(now.Add(time.Second*30)) {
t.Fatalf("Mtime of key should be within 10 seconds, but got %s", objs[1].Mtime().Sub(now))
t.Fatalf("Mtime of key should be within 30 seconds, but got %s", objs[1].Mtime().Sub(now))
}
} else {
t.Fatalf("list failed: %s", err2.Error())
@@ -243,7 +243,7 @@ func testStorage(t *testing.T, s ObjectStorage) {
}
now := time.Now()
if objs[0].Mtime().Before(now.Add(-30*time.Second)) || objs[0].Mtime().After(now.Add(time.Second*30)) {
t.Fatalf("Mtime of key should be within 10 seconds, but got %s", objs[0].Mtime().Sub(now))
t.Fatalf("Mtime of key should be within 30 seconds, but got %s", objs[0].Mtime().Sub(now))
}
} else {
t.Fatalf("list failed: %s", err2.Error())