Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid committed Dec 18, 2024
1 parent 00b774f commit d35d78a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/grpc/Database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ErrorCode,
DEFAULT_DB,
formatKeyValueData,
findKeyValue,
} from '../../milvus';
import {
IP,
Expand Down Expand Up @@ -194,7 +195,7 @@ describe(`Database API`, () => {
expect(createIndex.error_code).toEqual(ErrorCode.SUCCESS);

// alter index
const alterIndex = await milvusClient.alterIndex({
const alterIndex = await milvusClient.alterIndexProperties({
collection_name: COLLECTION_NAME2,
db_name: DB_NAME2,
index_name: 'vector2',
Expand All @@ -209,6 +210,26 @@ describe(`Database API`, () => {
index_name: 'vector2',
});
expect(describeIndex.index_descriptions[0].index_name).toEqual('vector2');
const p1 = describeIndex.index_descriptions[0].params;
expect(findKeyValue(p1, 'mmap.enabled')).toEqual('true');

// drop index properties
const dropIndexProperties = await milvusClient.dropIndexProperties({
collection_name: COLLECTION_NAME2,
db_name: DB_NAME2,
index_name: 'vector2',
properties: ['mmap.enabled'],
});
expect(dropIndexProperties.error_code).toEqual(ErrorCode.SUCCESS);

// describe index
const describeIndexAfterDrop = await milvusClient.describeIndex({
collection_name: COLLECTION_NAME2,
db_name: DB_NAME2,
index_name: 'vector2',
});
const p2 = describeIndexAfterDrop.index_descriptions[0].params;
expect(findKeyValue(p2, 'mmap.enabled')).toEqual(undefined);

// load collection
const loadCollection = await milvusClient.loadCollection({
Expand Down
17 changes: 17 additions & 0 deletions test/grpc/Index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,23 @@ describe(`Milvus Index API`, () => {
const params = describe.index_descriptions[0].params;
expect(findKeyValue(params, 'mmap.enabled')).toEqual('true');

const alter2 = await milvusClient.alterIndexProperties({
collection_name: COLLECTION_NAME,
index_name: INDEX_NAME,
params: {
'mmap.enabled': false,
},
});

const describe2 = await milvusClient.describeIndex({
collection_name: COLLECTION_NAME,
index_name: INDEX_NAME,
});

expect(alter2.error_code).toEqual(ErrorCode.SUCCESS);
const params2 = describe2.index_descriptions[0].params;
expect(findKeyValue(params2, 'mmap.enabled')).toEqual('false');

// console.log('describe', describe.index_descriptions[0].params);
});

Expand Down

0 comments on commit d35d78a

Please sign in to comment.