(t *testing.T)
| 456 | } |
| 457 | |
| 458 | func TestListBlocksWithPrefix(t *testing.T) { |
| 459 | tests := []struct { |
| 460 | name string |
| 461 | prefix string |
| 462 | tenant string |
| 463 | liveBlockIDs []uuid.UUID |
| 464 | compactedBlockIDs []uuid.UUID |
| 465 | httpHandler func(t *testing.T) http.HandlerFunc |
| 466 | }{ |
| 467 | { |
| 468 | name: "with prefix", |
| 469 | prefix: "a/b/c/", |
| 470 | tenant: "single-tenant", |
| 471 | liveBlockIDs: []uuid.UUID{uuid.MustParse("00000000-0000-0000-0000-000000000000")}, |
| 472 | compactedBlockIDs: []uuid.UUID{uuid.MustParse("00000000-0000-0000-0000-000000000001")}, |
| 473 | httpHandler: func(t *testing.T) http.HandlerFunc { |
| 474 | return func(w http.ResponseWriter, r *http.Request) { |
| 475 | if r.Method == "GET" { |
| 476 | assert.Equal(t, "a/b/c/single-tenant/", r.URL.Query().Get("prefix")) |
| 477 | |
| 478 | _, _ = w.Write([]byte(` |
| 479 | { |
| 480 | "kind": "storage#objects", |
| 481 | "items": [{ |
| 482 | "kind": "storage#object", |
| 483 | "id": "1", |
| 484 | "name": "a/b/c/single-tenant/00000000-0000-0000-0000-000000000000/meta.json", |
| 485 | "bucket": "blerg", |
| 486 | "storageClass": "STANDARD", |
| 487 | "size": "1024", |
| 488 | "timeCreated": "2024-03-01T00:00:00.000Z", |
| 489 | "updated": "2024-03-01T00:00:00.000Z" |
| 490 | }, { |
| 491 | "kind": "storage#object", |
| 492 | "id": "2", |
| 493 | "name": "a/b/c/single-tenant/00000000-0000-0000-0000-000000000001/meta.compacted.json", |
| 494 | "bucket": "blerg", |
| 495 | "storageClass": "STANDARD", |
| 496 | "size": "1024", |
| 497 | "timeCreated": "2024-03-01T00:00:00.000Z", |
| 498 | "updated": "2024-03-01T00:00:00.000Z" |
| 499 | }] |
| 500 | } |
| 501 | `)) |
| 502 | return |
| 503 | } |
| 504 | } |
| 505 | }, |
| 506 | }, |
| 507 | { |
| 508 | name: "without prefix", |
| 509 | prefix: "", |
| 510 | tenant: "single-tenant", |
| 511 | liveBlockIDs: []uuid.UUID{uuid.MustParse("00000000-0000-0000-0000-000000000000")}, |
| 512 | compactedBlockIDs: []uuid.UUID{uuid.MustParse("00000000-0000-0000-0000-000000000001")}, |
| 513 | httpHandler: func(t *testing.T) http.HandlerFunc { |
| 514 | return func(w http.ResponseWriter, r *http.Request) { |
| 515 | if r.Method == "GET" { |
nothing calls this directly
no test coverage detected