Skip to content

testdrive: fix catalog consistency check failure without license key#35401

Open
aljoscha wants to merge 1 commit intoMaterializeInc:mainfrom
aljoscha:push-xoltnsonxnpw
Open

testdrive: fix catalog consistency check failure without license key#35401
aljoscha wants to merge 1 commit intoMaterializeInc:mainfrom
aljoscha:push-xoltnsonxnpw

Conversation

@aljoscha
Copy link
Contributor

The testdrive binary was using ValidatedLicenseKey::default() when no license key was provided, while environmentd uses
ValidatedLicenseKey::disabled() in the same scenario (non-Kubernetes, no --license-key flag).

These two defaults differ in allow_credit_consumption_override:

  • default(): falsecredit_consumption_from_memory = true
  • disabled(): truecredit_consumption_from_memory = false

This caused a mismatch in credits_per_hour during the catalog consistency check. Environmentd would keep the JSON-provided credits value (e.g., 1), while testdrive's independent catalog open would recalculate credits from memory limits (e.g., 4 GiB / 1 GiB = 4). The consistency check then failed with a credits_per_hour lsu array diff.

In CI this was masked because MZ_CI_LICENSE_KEY is always set, so both environmentd and testdrive use the same validated license key.

Fix by using ValidatedLicenseKey::disabled() in testdrive to match environmentd's behavior when no license key is provided.

The testdrive binary was using `ValidatedLicenseKey::default()` when no
license key was provided, while environmentd uses
`ValidatedLicenseKey::disabled()` in the same scenario (non-Kubernetes,
no `--license-key` flag).

These two defaults differ in `allow_credit_consumption_override`:
- `default()`: `false` → `credit_consumption_from_memory = true`
- `disabled()`: `true` → `credit_consumption_from_memory = false`

This caused a mismatch in `credits_per_hour` during the catalog
consistency check. Environmentd would keep the JSON-provided credits
value (e.g., 1), while testdrive's independent catalog open would
recalculate credits from memory limits (e.g., 4 GiB / 1 GiB = 4).
The consistency check then failed with a `credits_per_hour` lsu array
diff.

In CI this was masked because `MZ_CI_LICENSE_KEY` is always set, so
both environmentd and testdrive use the same validated license key.

Fix by using `ValidatedLicenseKey::disabled()` in testdrive to match
environmentd's behavior when no license key is provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aljoscha aljoscha requested a review from def- March 10, 2026 15:34
@aljoscha aljoscha requested a review from a team as a code owner March 10, 2026 15:34
@github-actions
Copy link

Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone.

PR title guidelines

  • Use imperative mood: "Fix X" not "Fixed X" or "Fixes X"
  • Be specific: "Fix panic in catalog sync when controller restarts" not "Fix bug" or "Update catalog code"
  • Prefix with area if helpful: compute: , storage: , adapter: , sql:

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

Copy link
Contributor

@bkirwi bkirwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've run into this before but never looked into it... thank you!

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.

4 participants