From 503fec001077d52704560e1d36dabed57f8173df Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Wed, 9 Sep 2026 07:22:16 -0700 Subject: [PATCH] Address connection string login review feedback Clarify Mongo and Cassandra E2E test comments and retain formatting in the resolved connection flow. --- src/Platform/Hosted/Components/ConnectExplorer.tsx | 1 + test/cassandra/connectionStringLogin.spec.ts | 9 +++------ test/mongo/connectionStringLogin.spec.ts | 11 ++++------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Platform/Hosted/Components/ConnectExplorer.tsx b/src/Platform/Hosted/Components/ConnectExplorer.tsx index 3836723b1..8158b4baf 100644 --- a/src/Platform/Hosted/Components/ConnectExplorer.tsx +++ b/src/Platform/Hosted/Components/ConnectExplorer.tsx @@ -84,6 +84,7 @@ export const ConnectExplorer: React.FunctionComponent = ({ ); return; } + if (isDirectConnectionStringLoginApi(metadata.apiKind)) { setAccountMetadata(metadata); setAuthType(AuthType.ConnectionString); diff --git a/test/cassandra/connectionStringLogin.spec.ts b/test/cassandra/connectionStringLogin.spec.ts index b01aa5c60..228d067ec 100644 --- a/test/cassandra/connectionStringLogin.spec.ts +++ b/test/cassandra/connectionStringLogin.spec.ts @@ -25,9 +25,7 @@ async function loginWithConnectionString(page: Page, connectionString: string): await page.getByRole("button", { name: "Connect" }).click(); } -// Builds a Cassandra connection string for an account that the caller controls the name and key of, so -// the tests can point at a wrong key or an account that was never provisioned. The key is embedded raw, -// the way Azure hands it out; URL encoding it would turn the base64 padding into %3D and fail to decode. +// Builds a Cassandra connection string for an account function buildCassandraConnectionString(accountName: string, accountKey: string): string { return `HostName=${accountName}.cassandra.cosmos.azure.com;Username=${accountName};Password=${accountKey};Port=10350`; } @@ -155,9 +153,8 @@ test.describe("Cassandra account using connection string login", () => { }); test("opens Data Explorer when the account does not exist", async ({ page }) => { - // The UTC timestamp keeps the account name unique to this run, so it cannot collide with a real - // account that someone provisioned in the meantime. The token is issued without checking that the - // account exists, so login succeeds and only the requests made from inside the explorer fail. + // The token is issued without checking that the account exists, so login succeeds + // and only the requests made from inside the explorer fail. const missingAccountName = `de-test-missing-${new Date().toISOString().replace(/[^0-9]/g, "")}`; await loginWithConnectionString(page, buildCassandraConnectionString(missingAccountName, wrongAccountKey)); diff --git a/test/mongo/connectionStringLogin.spec.ts b/test/mongo/connectionStringLogin.spec.ts index 4de114278..96ddfe1c2 100644 --- a/test/mongo/connectionStringLogin.spec.ts +++ b/test/mongo/connectionStringLogin.spec.ts @@ -25,9 +25,7 @@ async function loginWithConnectionString(page: Page, connectionString: string): await page.getByRole("button", { name: "Connect" }).click(); } -// Builds a Mongo connection string for an account that the caller controls the name and key of, so the -// tests can point at a wrong key or an account that was never provisioned. The key is embedded raw, the -// way Azure hands it out; URL encoding it would turn the base64 padding into %3D and fail to decode. +// Builds a Mongo connection string for an account function buildMongoConnectionString(accountName: string, accountKey: string): string { return `mongodb://${accountName}:${accountKey}@${accountName}.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&appName=@${accountName}@`; } @@ -89,7 +87,7 @@ test.describe("Mongo account using connection string login", () => { await collectionNode.expand(); // Open the Documents node to load the tab and exercise the data plane, which for Mongo runs through - // the Portal Backend proxy using the encrypted token issued at login. + // the Portal Backend using the encrypted token issued at login. const documentsNode = await explorer.waitForContainerDocumentsNode(databaseId, collectionId); await documentsNode.element.click(); @@ -177,9 +175,8 @@ test.describe("Mongo account using connection string login", () => { }); test("opens Data Explorer when the account does not exist", async ({ page }) => { - // The UTC timestamp keeps the account name unique to this run, so it cannot collide with a real - // account that someone provisioned in the meantime. The token is issued without checking that the - // account exists, so login succeeds and only the requests made from inside Data Explorer fail. + // The token is issued without checking that the account exists, so login succeeds and + // only the requests made from inside Data Explorer fail. const missingAccountName = `de-test-missing-${new Date().toISOString().replace(/[^0-9]/g, "")}`; await loginWithConnectionString(page, buildMongoConnectionString(missingAccountName, wrongAccountKey));