mirror of https://github.com/minio/minio.git
fix: format test file with gofumpt
This commit is contained in:
parent
c16daabd12
commit
26c34b4cb7
|
@ -2058,7 +2058,7 @@ func TestListObjectsV2EmptyPrefixCommonPrefix(t *testing.T) {
|
|||
|
||||
func testListObjectsV2EmptyPrefixCommonPrefix(obj ObjectLayer, instanceType string, t1 TestErrHandler) {
|
||||
t, _ := t1.(*testing.T)
|
||||
|
||||
|
||||
bucket := "test-bucket-empty-prefix-common-prefix"
|
||||
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||
if err != nil {
|
||||
|
@ -2067,7 +2067,7 @@ func testListObjectsV2EmptyPrefixCommonPrefix(obj ObjectLayer, instanceType stri
|
|||
|
||||
testObjects := []string{
|
||||
"documents/file1.txt",
|
||||
"documents/file2.txt",
|
||||
"documents/file2.txt",
|
||||
"images/photo1.jpg",
|
||||
"images/photo2.jpg",
|
||||
"videos/movie1.mp4",
|
||||
|
@ -2082,7 +2082,7 @@ func testListObjectsV2EmptyPrefixCommonPrefix(obj ObjectLayer, instanceType stri
|
|||
t.Fatalf("%s: %s", instanceType, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result, err := obj.ListObjectsV2(context.Background(), bucket, "", "", "/", 1000, false, "")
|
||||
if err != nil {
|
||||
t.Fatalf("%s: Expected to pass, but failed with: %s", instanceType, err.Error())
|
||||
|
@ -2090,17 +2090,22 @@ func testListObjectsV2EmptyPrefixCommonPrefix(obj ObjectLayer, instanceType stri
|
|||
|
||||
expectedPrefixes := []string{"documents/", "images/", "videos/"}
|
||||
expectedObjects := []string{"root-file.txt"}
|
||||
|
||||
|
||||
if len(result.Prefixes) != len(expectedPrefixes) {
|
||||
t.Errorf("%s: Expected %d prefixes, got %d. Expected: %v, Got: %v",
|
||||
t.Errorf("%s: Expected %d prefixes, got %d. Expected: %v, Got: %v",
|
||||
instanceType, len(expectedPrefixes), len(result.Prefixes), expectedPrefixes, result.Prefixes)
|
||||
}
|
||||
|
||||
for i, expectedPrefix := range expectedPrefixes {
|
||||
if i >= len(result.Prefixes) || result.Prefixes[i] != expectedPrefix {
|
||||
t.Errorf("%s: Expected prefix %d to be '%s', but got '%s'",
|
||||
instanceType, i, expectedPrefix,
|
||||
func() string { if i < len(result.Prefixes) { return result.Prefixes[i] }; return "<missing>" }())
|
||||
t.Errorf("%s: Expected prefix %d to be '%s', but got '%s'",
|
||||
instanceType, i, expectedPrefix,
|
||||
func() string {
|
||||
if i < len(result.Prefixes) {
|
||||
return result.Prefixes[i]
|
||||
}
|
||||
return "<missing>"
|
||||
}())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2110,12 +2115,17 @@ func testListObjectsV2EmptyPrefixCommonPrefix(obj ObjectLayer, instanceType stri
|
|||
|
||||
for i, expectedObj := range expectedObjects {
|
||||
if i >= len(result.Objects) || result.Objects[i].Name != expectedObj {
|
||||
t.Errorf("%s: Expected object %d to be '%s', but got '%s'",
|
||||
t.Errorf("%s: Expected object %d to be '%s', but got '%s'",
|
||||
instanceType, i, expectedObj,
|
||||
func() string { if i < len(result.Objects) { return result.Objects[i].Name }; return "<missing>" }())
|
||||
func() string {
|
||||
if i < len(result.Objects) {
|
||||
return result.Objects[i].Name
|
||||
}
|
||||
return "<missing>"
|
||||
}())
|
||||
}
|
||||
}
|
||||
|
||||
t.Logf("%s: ListObjectsV2 empty prefix test passed. Found %d prefixes and %d objects",
|
||||
t.Logf("%s: ListObjectsV2 empty prefix test passed. Found %d prefixes and %d objects",
|
||||
instanceType, len(result.Prefixes), len(result.Objects))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue