mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-13 22:52:15 +00:00
Compare commits
11 Commits
master
...
users/sind
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79dbdbbe7f | ||
|
|
3f977df00d | ||
|
|
865e9c906b | ||
|
|
1c34425dd8 | ||
|
|
50a244e6f9 | ||
|
|
9dad75c2f9 | ||
|
|
876b531248 | ||
|
|
28fe5846b3 | ||
|
|
f8533abb64 | ||
|
|
2921294a3d | ||
|
|
a03c289da0 |
@@ -38,7 +38,7 @@ export function queryIterator(databaseId: string, collection: Collection, query:
|
||||
let continuationToken: string;
|
||||
return {
|
||||
fetchNext: () => {
|
||||
return queryDocuments(databaseId, collection, false, query).then((response) => {
|
||||
return queryDocuments(databaseId, collection, false, query, continuationToken).then((response) => {
|
||||
continuationToken = response.continuationToken;
|
||||
const headers: { [key: string]: string | number } = {};
|
||||
response.headers.forEach((value, key) => {
|
||||
|
||||
@@ -410,6 +410,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
||||
}
|
||||
defaultSelectedKey={this.props.databaseId}
|
||||
responsiveMode={999}
|
||||
onRenderOption={this.onRenderDatabaseOption}
|
||||
/>
|
||||
)}
|
||||
<Separator className="panelSeparator" style={{ marginTop: -4, marginBottom: -4 }} />
|
||||
@@ -1473,4 +1474,19 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
||||
TelemetryProcessor.traceFailure(Action.CreateCollection, failureTelemetryData, startKey);
|
||||
}
|
||||
}
|
||||
|
||||
private onRenderDatabaseOption = (
|
||||
option?: IDropdownOption,
|
||||
defaultRender?: (props?: IDropdownOption) => JSX.Element,
|
||||
): JSX.Element | null => {
|
||||
if (!option) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div data-testid={`database-option-${option.key}`}>
|
||||
{defaultRender ? defaultRender(option) : <span>{option.text}</span>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ export const defaultAccounts: Record<TestAccount, string> = {
|
||||
export const resourceGroupName = process.env.DE_TEST_RESOURCE_GROUP ?? "de-e2e-tests";
|
||||
export const subscriptionId = process.env.DE_TEST_SUBSCRIPTION_ID ?? "69e02f2d-f059-4409-9eac-97e8a276ae2c";
|
||||
export const TEST_AUTOSCALE_THROUGHPUT_RU = 1000;
|
||||
export const TEST_MANUAL_THROUGHPUT_RU = 800;
|
||||
export const TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K = 2000;
|
||||
export const TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K = 4000;
|
||||
export const TEST_MANUAL_THROUGHPUT_RU_2K = 2000;
|
||||
export const ONE_MINUTE_MS: number = 60 * 1000;
|
||||
|
||||
|
||||
132
test/mongo/pagination.spec.ts
Normal file
132
test/mongo/pagination.spec.ts
Normal file
@@ -0,0 +1,132 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { setupCORSBypass } from "../CORSBypass";
|
||||
import { DataExplorer, QueryTab, TestAccount, CommandBarButton, Editor } from "../fx";
|
||||
import { serializeMongoToJson } from "../testData";
|
||||
|
||||
const databaseId = "test-e2etests-mongo-pagination";
|
||||
const collectionId = "test-coll-mongo-pagination";
|
||||
let explorer: DataExplorer = null!;
|
||||
|
||||
test.setTimeout(5 * 60 * 1000);
|
||||
|
||||
test.describe("Test Mongo Pagination", () => {
|
||||
let queryTab: QueryTab;
|
||||
let queryEditor: Editor;
|
||||
|
||||
test.beforeEach("Open query tab", async ({ page }) => {
|
||||
await setupCORSBypass(page);
|
||||
explorer = await DataExplorer.open(page, TestAccount.MongoReadonly);
|
||||
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
await containerNode.expand();
|
||||
|
||||
const containerMenuNode = await explorer.waitForContainerDocumentsNode(databaseId, collectionId);
|
||||
await containerMenuNode.openContextMenu();
|
||||
await containerMenuNode.contextMenuItem("New Query").click();
|
||||
|
||||
queryTab = explorer.queryTab("tab0");
|
||||
queryEditor = queryTab.editor();
|
||||
await queryEditor.locator.waitFor({ timeout: 30 * 1000 });
|
||||
await queryTab.executeCTA.waitFor();
|
||||
await explorer.frame.getByTestId("NotificationConsole/ExpandCollapseButton").click();
|
||||
await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
|
||||
});
|
||||
|
||||
test("should execute a query and load more results", async ({ page }) => {
|
||||
const query = "{}";
|
||||
|
||||
await queryEditor.locator.click();
|
||||
await queryEditor.setText(query);
|
||||
|
||||
const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
|
||||
await executeQueryButton.click();
|
||||
|
||||
// Wait for query execution to complete
|
||||
await expect(queryTab.resultsView).toBeVisible({ timeout: 60000 });
|
||||
await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 30000 });
|
||||
|
||||
// Get initial results
|
||||
const resultText = await queryTab.resultsEditor.text();
|
||||
|
||||
if (!resultText || resultText.trim() === "" || resultText.trim() === "[]") {
|
||||
throw new Error("Query returned no results - the collection appears to be empty");
|
||||
}
|
||||
|
||||
const resultData = serializeMongoToJson(resultText);
|
||||
|
||||
if (resultData.length === 0) {
|
||||
throw new Error("Parsed results contain 0 documents - collection is empty");
|
||||
}
|
||||
|
||||
if (resultData.length < 100) {
|
||||
expect(resultData.length).toBeGreaterThan(0);
|
||||
return;
|
||||
}
|
||||
|
||||
expect(resultData.length).toBe(100);
|
||||
|
||||
// Pagination test
|
||||
let totalPagesLoaded = 1;
|
||||
const maxLoadMoreAttempts = 10;
|
||||
|
||||
for (let loadMoreAttempts = 0; loadMoreAttempts < maxLoadMoreAttempts; loadMoreAttempts++) {
|
||||
const loadMoreButton = queryTab.resultsView.getByText("Load more");
|
||||
|
||||
try {
|
||||
await expect(loadMoreButton).toBeVisible({ timeout: 5000 });
|
||||
} catch {
|
||||
// Load more button not visible - pagination complete
|
||||
break;
|
||||
}
|
||||
|
||||
const beforeClickText = await queryTab.resultsEditor.text();
|
||||
const beforeClickHash = Buffer.from(beforeClickText || "")
|
||||
.toString("base64")
|
||||
.substring(0, 50);
|
||||
|
||||
await loadMoreButton.click();
|
||||
|
||||
// Wait for content to update
|
||||
let editorContentChanged = false;
|
||||
for (let waitAttempt = 1; waitAttempt <= 3; waitAttempt++) {
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const currentEditorText = await queryTab.resultsEditor.text();
|
||||
const currentHash = Buffer.from(currentEditorText || "")
|
||||
.toString("base64")
|
||||
.substring(0, 50);
|
||||
|
||||
if (currentHash !== beforeClickHash) {
|
||||
editorContentChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (editorContentChanged) {
|
||||
totalPagesLoaded++;
|
||||
} else {
|
||||
// No content change detected, stop pagination
|
||||
break;
|
||||
}
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
}
|
||||
|
||||
// Final verification
|
||||
const finalIndicator = queryTab.resultsView.locator("text=/\\d+ - \\d+/");
|
||||
const finalIndicatorText = await finalIndicator.textContent();
|
||||
|
||||
if (finalIndicatorText) {
|
||||
const match = finalIndicatorText.match(/(\d+) - (\d+)/);
|
||||
if (match) {
|
||||
const totalDocuments = parseInt(match[2]);
|
||||
expect(totalDocuments).toBe(405);
|
||||
expect(totalPagesLoaded).toBe(5);
|
||||
} else {
|
||||
throw new Error(`Invalid results indicator format: ${finalIndicatorText}`);
|
||||
}
|
||||
} else {
|
||||
expect(totalPagesLoaded).toBe(5);
|
||||
}
|
||||
});
|
||||
});
|
||||
288
test/sql/scaleAndSettings/sharedThroughput.spec.ts
Normal file
288
test/sql/scaleAndSettings/sharedThroughput.spec.ts
Normal file
@@ -0,0 +1,288 @@
|
||||
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
|
||||
import { CosmosClient, CosmosClientOptions, Database } from "@azure/cosmos";
|
||||
import { AzureIdentityCredentialAdapter } from "@azure/ms-rest-js";
|
||||
import { Locator, expect, test } from "@playwright/test";
|
||||
import {
|
||||
CommandBarButton,
|
||||
DataExplorer,
|
||||
ONE_MINUTE_MS,
|
||||
TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K,
|
||||
TEST_MANUAL_THROUGHPUT_RU,
|
||||
TestAccount,
|
||||
generateUniqueName,
|
||||
getAccountName,
|
||||
getAzureCLICredentials,
|
||||
resourceGroupName,
|
||||
subscriptionId,
|
||||
} from "../../fx";
|
||||
|
||||
// Helper class for database context
|
||||
class TestDatabaseContext {
|
||||
constructor(
|
||||
public armClient: CosmosDBManagementClient,
|
||||
public client: CosmosClient,
|
||||
public database: Database,
|
||||
) {}
|
||||
|
||||
async dispose() {
|
||||
await this.database.delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Options for creating test database
|
||||
interface CreateTestDBOptions {
|
||||
throughput?: number;
|
||||
maxThroughput?: number; // For autoscale
|
||||
}
|
||||
|
||||
// Helper function to create a test database with shared throughput
|
||||
async function createTestDB(options?: CreateTestDBOptions): Promise<TestDatabaseContext> {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const credentials = getAzureCLICredentials();
|
||||
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
|
||||
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
|
||||
const accountName = getAccountName(TestAccount.SQL);
|
||||
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
|
||||
|
||||
const clientOptions: CosmosClientOptions = {
|
||||
endpoint: account.documentEndpoint!,
|
||||
};
|
||||
|
||||
const nosqlAccountRbacToken = process.env.NOSQL_TESTACCOUNT_TOKEN;
|
||||
if (nosqlAccountRbacToken) {
|
||||
clientOptions.tokenProvider = async (): Promise<string> => {
|
||||
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
||||
const authorizationToken = `${AUTH_PREFIX}${nosqlAccountRbacToken}`;
|
||||
return authorizationToken;
|
||||
};
|
||||
} else {
|
||||
const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName);
|
||||
clientOptions.key = keys.primaryMasterKey;
|
||||
}
|
||||
|
||||
const client = new CosmosClient(clientOptions);
|
||||
|
||||
// Create database with provisioned throughput (shared throughput)
|
||||
// This checks the "Provision database throughput" option
|
||||
const { database } = await client.databases.create({
|
||||
id: databaseId,
|
||||
throughput: options?.throughput, // Manual throughput (e.g., 400)
|
||||
maxThroughput: options?.maxThroughput, // Autoscale max throughput (e.g., 1000)
|
||||
});
|
||||
|
||||
return new TestDatabaseContext(armClient, client, database);
|
||||
}
|
||||
|
||||
test.describe("Database with Shared Throughput", () => {
|
||||
let dbContext: TestDatabaseContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
const containerId = "sharedcontainer";
|
||||
|
||||
// Helper methods
|
||||
const getThroughputInput = (type: "manual" | "autopilot"): Locator => {
|
||||
return explorer.frame.getByTestId(`${type}-throughput-input`);
|
||||
};
|
||||
|
||||
test.afterEach(async () => {
|
||||
// Clean up: delete the created database
|
||||
await dbContext?.dispose();
|
||||
});
|
||||
|
||||
test.describe("Manual Throughput Tests", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
});
|
||||
|
||||
test("Create database with shared manual throughput and verify Scale node in UI", async () => {
|
||||
test.setTimeout(120000); // 2 minutes timeout
|
||||
// Create database with shared manual throughput (400 RU/s)
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
// Verify database node appears in the tree
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
expect(databaseNode).toBeDefined();
|
||||
|
||||
// Expand the database node to see child nodes
|
||||
await databaseNode.expand();
|
||||
|
||||
// Verify that "Scale" node appears under the database
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
expect(scaleNode).toBeDefined();
|
||||
await expect(scaleNode.element).toBeVisible();
|
||||
});
|
||||
|
||||
test("Add container to shared database without dedicated throughput", async () => {
|
||||
// Create database with shared manual throughput
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
// Wait for the database to appear in the tree
|
||||
await explorer.waitForNode(dbContext.database.id);
|
||||
|
||||
// Add a container to the shared database via UI
|
||||
await explorer.frame.getByRole("button", { name: "New Container" }).click();
|
||||
|
||||
await explorer.whilePanelOpen(
|
||||
"New Container",
|
||||
async (panel, okButton) => {
|
||||
// Select "Use existing" database
|
||||
const useExistingRadio = panel.getByRole("radio", { name: /Use existing/i });
|
||||
await useExistingRadio.click();
|
||||
|
||||
// Select the database from dropdown using the new data-testid
|
||||
const databaseDropdown = panel.getByRole("combobox", { name: "Choose an existing database" });
|
||||
await databaseDropdown.click();
|
||||
|
||||
await explorer.frame.getByRole("option", { name: dbContext.database.id }).click();
|
||||
// Now you can target the specific database option by its data-testid
|
||||
//await panel.getByTestId(`database-option-${dbContext.database.id}`).click();
|
||||
// Fill container id
|
||||
await panel.getByRole("textbox", { name: "Container id, Example Container1" }).fill(containerId);
|
||||
|
||||
// Fill partition key
|
||||
await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
|
||||
|
||||
// Ensure "Provision dedicated throughput" is NOT checked
|
||||
const dedicatedThroughputCheckbox = panel.getByRole("checkbox", {
|
||||
name: /Provision dedicated throughput for this container/i,
|
||||
});
|
||||
|
||||
if (await dedicatedThroughputCheckbox.isVisible()) {
|
||||
const isChecked = await dedicatedThroughputCheckbox.isChecked();
|
||||
if (isChecked) {
|
||||
await dedicatedThroughputCheckbox.uncheck();
|
||||
}
|
||||
}
|
||||
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * ONE_MINUTE_MS },
|
||||
);
|
||||
|
||||
// Verify container was created under the database
|
||||
const containerNode = await explorer.waitForContainerNode(dbContext.database.id, containerId);
|
||||
expect(containerNode).toBeDefined();
|
||||
});
|
||||
|
||||
test("Scale shared database manual throughput", async () => {
|
||||
// Create database with shared manual throughput (400 RU/s)
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
// Navigate to the scale settings by clicking the "Scale" node in the tree
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
await databaseNode.expand();
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
await scaleNode.element.click();
|
||||
|
||||
// Update manual throughput from 400 to 800
|
||||
await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU.toString());
|
||||
|
||||
// Save changes
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
`Successfully updated offer for database ${dbContext.database.id}`,
|
||||
{ timeout: 2 * ONE_MINUTE_MS },
|
||||
);
|
||||
});
|
||||
|
||||
test("Scale shared database from manual to autoscale", async () => {
|
||||
// Create database with shared manual throughput (400 RU/s)
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
// Open database settings by clicking the "Scale" node
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
await databaseNode.expand();
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
await scaleNode.element.click();
|
||||
|
||||
// Switch to Autoscale
|
||||
const autoscaleRadio = explorer.frame.getByText("Autoscale", { exact: true });
|
||||
await autoscaleRadio.click();
|
||||
|
||||
// Set autoscale max throughput to 1000
|
||||
//await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
|
||||
// Save changes
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
`Successfully updated offer for database ${dbContext.database.id}`,
|
||||
{ timeout: 2 * ONE_MINUTE_MS },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Autoscale Throughput Tests", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
});
|
||||
|
||||
test("Create database with shared autoscale throughput and verify Scale node in UI", async () => {
|
||||
test.setTimeout(120000); // 2 minutes timeout
|
||||
|
||||
// Create database with shared autoscale throughput (max 1000 RU/s)
|
||||
dbContext = await createTestDB({ maxThroughput: 1000 });
|
||||
|
||||
// Verify database node appears
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
expect(databaseNode).toBeDefined();
|
||||
|
||||
// Expand the database node to see child nodes
|
||||
await databaseNode.expand();
|
||||
|
||||
// Verify that "Scale" node appears under the database
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
expect(scaleNode).toBeDefined();
|
||||
await expect(scaleNode.element).toBeVisible();
|
||||
});
|
||||
|
||||
test("Scale shared database autoscale throughput", async () => {
|
||||
// Create database with shared autoscale throughput (max 1000 RU/s)
|
||||
dbContext = await createTestDB({ maxThroughput: 1000 });
|
||||
|
||||
// Open database settings
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
await databaseNode.expand();
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
await scaleNode.element.click();
|
||||
|
||||
// Update autoscale max throughput from 1000 to 4000
|
||||
await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K.toString());
|
||||
|
||||
// Save changes
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
`Successfully updated offer for database ${dbContext.database.id}`,
|
||||
{ timeout: 2 * ONE_MINUTE_MS },
|
||||
);
|
||||
});
|
||||
|
||||
test("Scale shared database from autoscale to manual", async () => {
|
||||
// Create database with shared autoscale throughput (max 1000 RU/s)
|
||||
dbContext = await createTestDB({ maxThroughput: 1000 });
|
||||
|
||||
// Open database settings
|
||||
const databaseNode = await explorer.waitForNode(dbContext.database.id);
|
||||
await databaseNode.expand();
|
||||
const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
|
||||
await scaleNode.element.click();
|
||||
|
||||
// Switch to Manual
|
||||
const manualRadio = explorer.frame.getByText("Manual", { exact: true });
|
||||
await manualRadio.click();
|
||||
|
||||
// Save changes
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
`Successfully updated offer for database ${dbContext.database.id}`,
|
||||
{ timeout: 2 * ONE_MINUTE_MS },
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -82,6 +82,60 @@ export class TestContainerContext {
|
||||
}
|
||||
}
|
||||
|
||||
export class TestDatabaseContext {
|
||||
constructor(
|
||||
public armClient: CosmosDBManagementClient,
|
||||
public client: CosmosClient,
|
||||
public database: Database,
|
||||
) {}
|
||||
|
||||
async dispose() {
|
||||
await this.database.delete();
|
||||
}
|
||||
}
|
||||
|
||||
export interface CreateTestDBOptions {
|
||||
throughput?: number;
|
||||
maxThroughput?: number; // For autoscale
|
||||
}
|
||||
|
||||
export async function createTestDB(options?: CreateTestDBOptions): Promise<TestDatabaseContext> {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const credentials = getAzureCLICredentials();
|
||||
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
|
||||
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
|
||||
const accountName = getAccountName(TestAccount.SQL);
|
||||
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
|
||||
|
||||
const clientOptions: CosmosClientOptions = {
|
||||
endpoint: account.documentEndpoint!,
|
||||
};
|
||||
|
||||
const nosqlAccountRbacToken = process.env.NOSQL_TESTACCOUNT_TOKEN;
|
||||
if (nosqlAccountRbacToken) {
|
||||
clientOptions.tokenProvider = async (): Promise<string> => {
|
||||
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
||||
const authorizationToken = `${AUTH_PREFIX}${nosqlAccountRbacToken}`;
|
||||
return authorizationToken;
|
||||
};
|
||||
} else {
|
||||
const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName);
|
||||
clientOptions.key = keys.primaryMasterKey;
|
||||
}
|
||||
|
||||
const client = new CosmosClient(clientOptions);
|
||||
|
||||
// Create database with provisioned throughput (shared throughput)
|
||||
// This checks the "Provision database throughput" option
|
||||
const { database } = await client.databases.create({
|
||||
id: databaseId,
|
||||
throughput: options?.throughput, // Manual throughput (e.g., 400)
|
||||
maxThroughput: options?.maxThroughput, // Autoscale max throughput (e.g., 1000)
|
||||
});
|
||||
|
||||
return new TestDatabaseContext(armClient, client, database);
|
||||
}
|
||||
|
||||
type createTestSqlContainerConfig = {
|
||||
includeTestData?: boolean;
|
||||
partitionKey?: string;
|
||||
|
||||
Reference in New Issue
Block a user