MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / testListObjectsTestsForNonExistantBucket

Function testListObjectsTestsForNonExistantBucket

cmd/object_api_suite_test.go:769–783  ·  view source on GitHub ↗

Tests validate that ListObjects operation on a non-existent bucket fails as expected.

(obj ObjectLayer, instanceType string, t TestErrHandler)

Source from the content-addressed store, hash-verified

767
768// Tests validate that ListObjects operation on a non-existent bucket fails as expected.
769func 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.
786func TestNonExistantObjectInBucket(t *testing.T) {

Callers

nothing calls this directly

Calls 2

ListObjectsMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected