Default throughput bucket (#2460)

* default throughput bucket

* nit

* show inactive buckets

* add e2e tests for default throughput bucket

* for test sql containers, use throughput of 4000

* remove container throughput on creation

* added offer throughput

* add default throughput bucket info link

* add text localization

* upgrade playwright

* Fix flaky permissionsScreen test by using unrouteAll with ignoreErrors

* fix: move container creation to beforeAll to reduce CI shard timeout

* remove comment

---------

Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
asier-isayas
2026-04-17 12:10:52 -04:00
committed by GitHub
parent 57a1876130
commit 93ef9e2cc2
10 changed files with 286 additions and 50 deletions

View File

@@ -23,7 +23,9 @@ test.describe("Computed Properties", () => {
});
test.afterAll("Delete Test Database", async () => {
await context?.dispose();
if (!process.env.CI) {
await context?.dispose();
}
});
test("Add valid computed property", async ({ page }) => {

View File

@@ -0,0 +1,108 @@
import { expect, test } from "@playwright/test";
import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
import { createTestSQLContainer, TestContainerContext } from "../../testData";
test.describe("Throughput bucket settings", () => {
let context: TestContainerContext = null!;
let explorer: DataExplorer = null!;
test.beforeAll("Create Test Database", async () => {
context = await createTestSQLContainer();
});
test.beforeEach("Open Throughput Bucket Settings", async ({ browser }) => {
const page = await browser.newPage();
explorer = await DataExplorer.open(page, TestAccount.SQL);
// Click Scale & Settings and open Throughput Bucket Settings tab
await explorer.openScaleAndSettings(context);
const throughputBucketTab = explorer.frame.getByTestId("settings-tab-header/ThroughputBucketsTab");
await throughputBucketTab.click();
});
// Delete database only if not running in CI
if (!process.env.CI) {
test.afterAll("Delete Test Database", async () => {
await context?.dispose();
});
}
test("Activate throughput bucket #2", async () => {
// Activate bucket 2
const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle");
await bucket2Toggle.click();
await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
});
test("Activate throughput buckets #1 and #2", async () => {
// Activate bucket 1
const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
await bucket1Toggle.click();
// Activate bucket 2
const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle");
await bucket2Toggle.click();
await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
});
test("Set throughput percentage for bucket #1", async () => {
// Set throughput percentage for bucket 1 (inactive) - Should be disabled
const bucket1PercentageInput = explorer.frame.getByTestId("bucket-1-percentage-input");
expect(bucket1PercentageInput).toBeDisabled();
// Activate bucket 1
const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
await bucket1Toggle.click();
expect(bucket1PercentageInput).toBeEnabled();
await bucket1PercentageInput.fill("40");
await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
});
test("Set default throughput bucket", async () => {
// There are no active throughput buckets so they all should be disabled
const defaultThroughputBucketDropdown = explorer.frame.getByTestId("default-throughput-bucket-dropdown");
await defaultThroughputBucketDropdown.click();
const bucket1Option = explorer.frame.getByRole("option", { name: "Bucket 1" });
expect(bucket1Option).toBeDisabled();
// Activate bucket 1
const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
await bucket1Toggle.click();
// Open dropdown again
await defaultThroughputBucketDropdown.click();
expect(bucket1Option).toBeEnabled();
// Select bucket 1 as default
await bucket1Option.click();
await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`,
{
timeout: 2 * ONE_MINUTE_MS,
},
);
});
});