Tests validate that ListObjects operation on a non-existent bucket fails as expected.
(obj ObjectLayer, instanceType string, t TestErrHandler)
| 767 | |
| 768 | // Tests validate that ListObjects operation on a non-existent bucket fails as expected. |
| 769 | func testListObjectsTestsForNonExistantBucket(obj ObjectLayer, instanceType string, t TestErrHandler) { |
| 770 | result, err := obj.ListObjects(context.Background(), "bucket", "", "", "", 1000) |
| 771 | if err == nil { |
| 772 | t.Fatalf("%s: Expected error but found nil.", instanceType) |
| 773 | } |
| 774 | if len(result.Objects) != 0 { |
| 775 | t.Fatalf("%s: Expected number of objects in the result to be `%d`, but instead found `%d`", instanceType, 0, len(result.Objects)) |
| 776 | } |
| 777 | if result.IsTruncated { |
| 778 | t.Fatalf("%s: Expected IsTruncated to be `false`, but instead found it to be `%v`", instanceType, result.IsTruncated) |
| 779 | } |
| 780 | if err.Error() != "Bucket not found: bucket" { |
| 781 | t.Errorf("%s: Expected the error msg to be `%s`, but instead found `%s`", instanceType, "Bucket not found: bucket", err.Error()) |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | // Wrapper for calling testNonExistantObjectInBucket for both Erasure and FS. |
| 786 | func TestNonExistantObjectInBucket(t *testing.T) { |
nothing calls this directly
no test coverage detected