Skip to content

test: keep TestConstants from switching the app's tenant mode - #2661

Open
erichare wants to merge 2 commits into
mainfrom
fix/test-constants-tenant-leak
Open

erichare wants to merge 2 commits into
mainfrom
fix/test-constants-tenant-leak

Conversation

@erichare

@erichare erichare commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does:

TestConstants no longer resets the shared TenantFactory to ASTRA. It initializes the factory only when unset and builds its ASTRA tenant directly, preserving the app's tenant mode in a @QuarkusTest. A new McpProtocolTest case covers a raw tools/call after constructing TestConstants.

Which issue(s) this PR fixes:

No issue filed. Found while working on #2625.

Verification

Focused local test passed with 2 tests, 0 failures, 0 errors, and 0 skipped:

JAVA_HOME=$(/usr/libexec/java_home -v 21) ./mvnw -B -ntp -Dquarkus.http.test-port=19080 -Dtest=McpProtocolTest test

Current GitHub checks pass for unit tests and both DSE and HCD integration tests. No full unit suite or local integration suite was rerun for this cleanup.

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

TestConstants reset the TenantFactory singleton and initialized it as
ASTRA every time it was built. A QuarkusTest shares that singleton with
the running app, which initializes it from config as CASSANDRA, so any
later MCP tools/call on the same profile failed tenant resolution.

Initialize the factory only when nothing has, and build TENANT directly
with Tenant.create. Add a raw tools/call check to McpProtocolTest that
builds TestConstants first and expects MCP_FEATURE_NOT_ENABLED.
@erichare
erichare requested a review from a team as a code owner October 23, 2026 22:16
@github-actions

Copy link
Copy Markdown
Contributor

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 55.07%
This PR 55.24%
Delta 🟢 +0.17%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

Overall Project 55.24% 🍏

There is no coverage information present for the Files changed

@github-actions

Copy link
Copy Markdown
Contributor

📈 Integration Test Coverage Delta vs Main Branch (dse69-it)

Metric Value
Main Branch 73.04%
This PR 73.04%
Delta 🟢 +0.00%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (dse69-it)

Overall Project 73.04% 🍏

There is no coverage information present for the Files changed

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

📈 Integration Test Coverage Delta vs Main Branch (hcd-it)

Metric Value
Main Branch 74.35%
This PR 74.35%
Delta 🟢 +0.00%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (hcd-it)

Overall Project 74.35% 🍏

There is no coverage information present for the Files changed

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant