Skip to content

Commit

Permalink
Make index tests a bit more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
aulorbe committed Jan 7, 2025
1 parent f2b54c1 commit 9fa9108
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/integration/control/configureIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,27 +160,46 @@ describe('configure index', () => {
});

await pinecone.configureIndex(serverlessIndexName, {
tags: { project: '' },
tags: { testTag: '' },
});
const description2 = await pinecone.describeIndex(serverlessIndexName);
if (description2.tags != null) {
expect(description2.tags['project']).toBeUndefined();
expect(description2.tags['testTag']).toEqual('testValue');
expect(description2.tags['testTag']).toBeUndefined();
expect(description2.tags['project']).toEqual(
'pinecone-integration-tests'
);
}

// Confirm when config'ing other things about the index, tags are not changed
await pinecone.configureIndex(serverlessIndexName, {
deletionProtection: 'enabled',
});
const description3 = await pinecone.describeIndex(serverlessIndexName);
if (description3.tags != null) {
expect(description3.tags['testTag']).toBeUndefined();
expect(description3.tags['project']).toEqual(
'pinecone-integration-tests'
);
}

// (Cleanup) Disable deletion protection
await pinecone.configureIndex(serverlessIndexName, {
deletionProtection: 'disabled',
});
});

test('Update a tag value in a serverless index', async () => {
const description = await pinecone.describeIndex(serverlessIndexName);
expect(description.tags).toEqual({
testTag: 'testValue',
project: 'pinecone-integration-tests',
});

await pinecone.configureIndex(serverlessIndexName, {
tags: { testTag: 'newValue' },
tags: { project: 'updated-project' },
});
const description2 = await pinecone.describeIndex(serverlessIndexName);
if (description2.tags != null) {
expect(description2.tags['testTag']).toEqual('newValue');
expect(description2.tags['project']).toEqual('updated-project');
}
});
});
Expand Down

0 comments on commit 9fa9108

Please sign in to comment.