Add E2E tests for partition key change workflow (#2293)

This commit is contained in:
BChoudhury-ms
2025-12-29 15:08:54 +05:30
committed by GitHub
parent 42e230b88b
commit be89c634f3
9 changed files with 144 additions and 10 deletions

View File

@@ -74,8 +74,18 @@ export class TestContainerContext {
}
}
export async function createTestSQLContainer(includeTestData?: boolean) {
const databaseId = generateUniqueName("db");
type createTestSqlContainerConfig = {
includeTestData?: boolean;
partitionKey?: string;
databaseName?: string;
};
export async function createTestSQLContainer({
includeTestData = false,
partitionKey = "/partitionKey",
databaseName = "",
}: createTestSqlContainerConfig = {}) {
const databaseId = databaseName ? databaseName : generateUniqueName("db");
const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique
const credentials = getAzureCLICredentials();
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
@@ -104,7 +114,7 @@ export async function createTestSQLContainer(includeTestData?: boolean) {
try {
const { container } = await database.containers.createIfNotExists({
id: containerId,
partitionKey: "/partitionKey",
partitionKey,
});
if (includeTestData) {
const batchCount = TestData.length / 100;