(t *testing.T, storage StorageAPI)
| 161 | } |
| 162 | |
| 163 | func 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 | |
| 193 | func testStorageAPIListDir(t *testing.T, storage StorageAPI) { |
| 194 | err := storage.MakeVol(context.Background(), "foo") |
no test coverage detected