Address connection string login review feedback

Clarify Mongo and Cassandra E2E test comments and retain formatting in the resolved connection flow.
This commit is contained in:
Asier Isayas
2026-09-09 07:22:16 -07:00
parent a2f6fbf2f5
commit 503fec0010
3 changed files with 8 additions and 13 deletions
@@ -84,6 +84,7 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
); );
return; return;
} }
if (isDirectConnectionStringLoginApi(metadata.apiKind)) { if (isDirectConnectionStringLoginApi(metadata.apiKind)) {
setAccountMetadata(metadata); setAccountMetadata(metadata);
setAuthType(AuthType.ConnectionString); setAuthType(AuthType.ConnectionString);
+3 -6
View File
@@ -25,9 +25,7 @@ async function loginWithConnectionString(page: Page, connectionString: string):
await page.getByRole("button", { name: "Connect" }).click(); 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 // Builds a Cassandra connection string for an account
// 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.
function buildCassandraConnectionString(accountName: string, accountKey: string): string { function buildCassandraConnectionString(accountName: string, accountKey: string): string {
return `HostName=${accountName}.cassandra.cosmos.azure.com;Username=${accountName};Password=${accountKey};Port=10350`; 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 }) => { 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 // The token is issued without checking that the account exists, so login succeeds
// account that someone provisioned in the meantime. The token is issued without checking that the // and only the requests made from inside the explorer fail.
// 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, "")}`; const missingAccountName = `de-test-missing-${new Date().toISOString().replace(/[^0-9]/g, "")}`;
await loginWithConnectionString(page, buildCassandraConnectionString(missingAccountName, wrongAccountKey)); await loginWithConnectionString(page, buildCassandraConnectionString(missingAccountName, wrongAccountKey));
+4 -7
View File
@@ -25,9 +25,7 @@ async function loginWithConnectionString(page: Page, connectionString: string):
await page.getByRole("button", { name: "Connect" }).click(); 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 // Builds a Mongo connection string for an account
// 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.
function buildMongoConnectionString(accountName: string, accountKey: string): string { 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}@`; 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(); await collectionNode.expand();
// Open the Documents node to load the tab and exercise the data plane, which for Mongo runs through // 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); const documentsNode = await explorer.waitForContainerDocumentsNode(databaseId, collectionId);
await documentsNode.element.click(); 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 }) => { 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 // The token is issued without checking that the account exists, so login succeeds and
// account that someone provisioned in the meantime. The token is issued without checking that the // only the requests made from inside Data Explorer fail.
// 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, "")}`; const missingAccountName = `de-test-missing-${new Date().toISOString().replace(/[^0-9]/g, "")}`;
await loginWithConnectionString(page, buildMongoConnectionString(missingAccountName, wrongAccountKey)); await loginWithConnectionString(page, buildMongoConnectionString(missingAccountName, wrongAccountKey));