Skip to content

[cosmos] Use fixed self-owned accounts for key-based live tests#49735

Draft
tvaron3 wants to merge 2 commits into
Azure:mainfrom
tvaron3:tvaron3/cosmos-livetest-sub-tenant
Draft

[cosmos] Use fixed self-owned accounts for key-based live tests#49735
tvaron3 wants to merge 2 commits into
Azure:mainfrom
tvaron3:tvaron3/cosmos-livetest-sub-tenant

Conversation

@tvaron3

@tvaron3 tvaron3 commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Point the key-based Cosmos live tests at fixed, self-owned Cosmos accounts (resource group sdk-ci) instead of provisioning a new account per pipeline run. This removes the central EngSys service-connection / on-the-fly-provisioning dependency for these tests, which is required so the tests can run against accounts in an ephemeral tenant that is recreated every ~90 days.

This PR wires up two stages as the first step: the main Cosmos_live_test stage and Cosmos_Live_Test_Http2.

What changed

  • New sdk/cosmos/pipeline/ mechanism — a single ADO variable-group secret (sub-config-cosmos-azure-cloud-test-resources) holds a versioned JSON mapping a logical account name → { endpoint, key, secondaryKey, ... }:
    • live-test-accounts.schema.json + live-test-accounts.sample.json
    • resolve-cosmos-test-account.sh (bash + jq): resolves one account by selector and exports ACCOUNT_HOST / ACCOUNT_KEY (+ SECONDARY_ACCOUNT_KEY). The key uses the azure-sdk double-set convention (_ACCOUNT_KEY secret to mask it in logs + a plain ACCOUNT_KEY so it propagates to the Maven test env). It does not emit ACCOUNT_CONSISTENCY / PREFERRED_LOCATIONS — those stay matrix-controlled.
    • resolve-cosmos-test-account.tests.sh (8 local tests, all pass)
    • resolve-test-account-steps.yml (reusable PreTestRunSteps template)
    • README.md
  • tests.ymlCosmos_live_test and Cosmos_Live_Test_Http2 set DisableAzureResourceCreation: true and run the resolve pre-step.
  • live-platform-matrix.json — each leg gets an AccountSelector so the multi-config main stage picks the right fixed account per leg.

Not included (follow-ups)

Left on the existing provisioning path because they need feature-enabled accounts or a separate pipeline:

  • Thin-client stages (×3) and GSI — accounts need thin-client / GSI-preview enablement.
  • Kafka — entangled with AAD auth; belongs in a separate AAD pipeline.
  • Spring Data Cosmos — uses its own test-resources (AZURE_SPRING_TENANT_ID).

The companion account-provisioning + Key Vault scripts live in the cosmos-sdk-copilot-toolkit repo (separate PR).

Verification

  • resolve-cosmos-test-account.sh: 8/8 local unit tests pass; YAML/JSON validated.
  • Fixed accounts + secret provisioned; each account carries a secondaryKey (required by AzureKeyCredentialTest in the -Pfast legs).
  • ⚠️ Needs a live pipeline run to fully validate before merge.

Draft

Draft while the two wired stages are validated end-to-end in a real pipeline run.

Point the main Cosmos live-test stage and the Http2 stage at fixed,
self-owned Cosmos accounts (RG sdk-ci) instead of provisioning an account
per pipeline run. This removes the central EngSys service-connection /
on-the-fly-provisioning dependency for the key-based tests.

- Add sdk/cosmos/pipeline/ with a single-secret JSON mechanism:
  - live-test-accounts.schema.json + sample
  - resolve-cosmos-test-account.sh (bash+jq) resolves one account from the
    single secret (sub-config-cosmos-azure-cloud-test-resources) by selector
    and exports ACCOUNT_HOST/ACCOUNT_KEY(+SECONDARY) using the azure-sdk
    double-set convention so the key is masked in logs yet reaches the test env
  - resolve-cosmos-test-account.tests.sh (local tests)
  - resolve-test-account-steps.yml (reusable PreTestRunSteps template)
- tests.yml: Cosmos_live_test + Cosmos_Live_Test_Http2 set
  DisableAzureResourceCreation:true and run the resolve pre-step.
- live-platform-matrix.json: add per-leg AccountSelector.

Thin-client, GSI, Kafka and Spring stages are intentionally left on the
existing provisioning path (they need feature-enabled accounts or a separate
AAD pipeline) and will be migrated in follow-ups.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Cosmos label Jul 6, 2026
@tvaron3

tvaron3 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@tvaron3

tvaron3 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

…test-sub-tenant

# Conflicts:
#	sdk/cosmos/live-platform-matrix.json
@tvaron3

tvaron3 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant