|
9 | 9 | "testing"
|
10 | 10 | "time"
|
11 | 11 |
|
| 12 | + "github.com/chroma-core/chroma/go/pkg/proto/coordinatorpb" |
12 | 13 | "github.com/chroma-core/chroma/go/pkg/sysdb/metastore/db/dao"
|
13 | 14 | s3metastore "github.com/chroma-core/chroma/go/pkg/sysdb/metastore/s3"
|
14 | 15 | "github.com/pingcap/log"
|
@@ -1484,6 +1485,34 @@ func (suite *APIsTestSuite) TestForkCollection() {
|
1484 | 1485 | suite.Empty(collections)
|
1485 | 1486 | }
|
1486 | 1487 |
|
| 1488 | +func (suite *APIsTestSuite) TestBatchGetCollectionVersionFilePaths() { |
| 1489 | + ctx := context.Background() |
| 1490 | + |
| 1491 | + // Create a new collection |
| 1492 | + newCollection := &model.CreateCollection{ |
| 1493 | + ID: types.NewUniqueID(), |
| 1494 | + Name: "test_batch_get_collection_version_file_paths", |
| 1495 | + TenantID: suite.tenantName, |
| 1496 | + DatabaseName: suite.databaseName, |
| 1497 | + } |
| 1498 | + |
| 1499 | + // Create the collection |
| 1500 | + _, _, err := suite.coordinator.CreateCollection(ctx, newCollection) |
| 1501 | + suite.NoError(err) |
| 1502 | + |
| 1503 | + // Get the version file paths for the collection |
| 1504 | + versionFilePaths, err := suite.coordinator.BatchGetCollectionVersionFilePaths(ctx, &coordinatorpb.BatchGetCollectionVersionFilePathsRequest{ |
| 1505 | + CollectionIds: []string{newCollection.ID.String()}, |
| 1506 | + }) |
| 1507 | + suite.NoError(err) |
| 1508 | + suite.Len(versionFilePaths, 1) |
| 1509 | + |
| 1510 | + // Verify version file exists in S3 |
| 1511 | + exists, err := suite.s3MetaStore.HasObjectWithPrefix(ctx, versionFilePaths.CollectionIdToVersionFilePath[newCollection.ID.String()]) |
| 1512 | + suite.NoError(err) |
| 1513 | + suite.True(exists, "Version file should exist in S3") |
| 1514 | +} |
| 1515 | + |
1487 | 1516 | func TestAPIsTestSuite(t *testing.T) {
|
1488 | 1517 | testSuite := new(APIsTestSuite)
|
1489 | 1518 | suite.Run(t, testSuite)
|
|
0 commit comments