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

Function testStorageAPIStatInfoFile

cmd/storage-rest_test.go:163–191  ·  view source on GitHub ↗
(t *testing.T, storage StorageAPI)

Source from the content-addressed store, hash-verified

161}
162
163func testStorageAPIStatInfoFile(t *testing.T, storage StorageAPI) {
164 err := storage.MakeVol(context.Background(), "foo")
165 if err != nil {
166 t.Fatalf("unexpected error %v", err)
167 }
168 err = storage.AppendFile(context.Background(), "foo", pathJoin("myobject", xlStorageFormatFile), []byte("foo"))
169 if err != nil {
170 t.Fatalf("unexpected error %v", err)
171 }
172
173 testCases := []struct {
174 volumeName string
175 objectName string
176 expectErr bool
177 }{
178 {"foo", "myobject", false},
179 // file not found error.
180 {"foo", "yourobject", true},
181 }
182
183 for i, testCase := range testCases {
184 _, err := storage.StatInfoFile(context.Background(), testCase.volumeName, testCase.objectName+"/"+xlStorageFormatFile, false)
185 expectErr := (err != nil)
186
187 if expectErr != testCase.expectErr {
188 t.Fatalf("case %v: error: expected: %v, got: %v, err: %v", i+1, expectErr, testCase.expectErr, err)
189 }
190 }
191}
192
193func testStorageAPIListDir(t *testing.T, storage StorageAPI) {
194 err := storage.MakeVol(context.Background(), "foo")

Callers 1

Calls 4

pathJoinFunction · 0.85
MakeVolMethod · 0.65
AppendFileMethod · 0.65
StatInfoFileMethod · 0.65

Tested by

no test coverage detected