Skip to content

Fix scorecard acceptance test CQL + run acceptance tests on PRs#102

Merged
mmaikel merged 4 commits into
mainfrom
fix-scorecard-acceptance-cql
Jul 1, 2026
Merged

Fix scorecard acceptance test CQL + run acceptance tests on PRs#102
mmaikel merged 4 commits into
mainfrom
fix-scorecard-acceptance-cql

Conversation

@mmaikel

@mmaikel mmaikel commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Two changes

Run acceptance tests on PRs (close the CI gap)

Acceptance tests previously ran only on push to main, so live-tenant breakages surfaced only post-merge. Consolidated main-test.yml into test.yml with an acceptance-test job that runs on push to main and same-repo PRs.

Guards:

  • Forked PRs are skippedsecrets.CORTEX_API_TOKEN is never exposed to fork-triggered workflows; those remain verified after merge.
  • Serialized repo-wide via a cortex-acceptance-tenant concurrency group (cancel-in-progress: false) because the tests share one live tenant with static resource tags, so concurrent runs would collide.

Verification

  • gofmt clean, go vet passes locally.
  • This PR is from a same-repo branch, so the new acceptance job runs on the PR itself — proving both the CQL fix and the new gating before merge.

🤖 Generated with Claude Code

mmaikel and others added 2 commits June 29, 2026 20:21
The scorecard filter fixtures used "owners_is_set", which the Cortex
backend's CQL grammar no longer accepts:

  400 BAD_REQUEST: The [COMPOUND_FILTER] filter is not valid:
  "Invalid expression: owners_is_set"

Replace it with the current equivalent "ownership != null" in the
fixtures and the corresponding TestCheckResourceAttr assertions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Acceptance tests previously ran only on push to main (main-test.yml), so
breakages against the live Cortex tenant surfaced only after merge.

Consolidate everything into test.yml and add an acceptance-test job that
runs on pushes to main and on same-repo PRs. Guards:

- Skipped for forked PRs, where secrets.CORTEX_API_TOKEN is unavailable;
  those are still verified after merge to main.
- Serialized repo-wide via a 'cortex-acceptance-tenant' concurrency group
  (cancel-in-progress: false) since the tests share one live tenant and
  use static resource tags, so concurrent runs would collide.

Delete the now-redundant main-test.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mmaikel mmaikel changed the title Fix scorecard acceptance tests: replace retired owners_is_set CQL filter Fix scorecard acceptance test CQL + run acceptance tests on PRs Jun 29, 2026
@mmaikel mmaikel requested review from AdmTal, akwirick, haowenchan661 and kienan and removed request for akwirick June 29, 2026 18:29
The provider defaults to https://api.getcortexapp.com when CORTEX_API_URL
is unset (which CI does not set), so acceptance tests create and destroy
real resources in the production tenant owned by CORTEX_API_TOKEN. "live"
was ambiguous about whether this meant production.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mmaikel

mmaikel commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Deferring the CI-gap change (running acceptance tests on PRs) to a follow-up. The test-only fix has been split out to #103 for today's release. Branch fix-scorecard-acceptance-cql is preserved; once #103 merges, rebasing this branch on main will drop the duplicate test commit, leaving the workflow change only. Marked draft to prevent accidental merge.

mmaikel added a commit that referenced this pull request Jun 29, 2026
…er (#103)

## Problem

`TestAccScorecardResourceComplete` fails because the scorecard filter
fixtures hardcode `query = "owners_is_set"`, which the Cortex backend's
CQL grammar no longer accepts:

```
400 BAD_REQUEST: The [COMPOUND_FILTER] filter is not valid: "Invalid expression: owners_is_set"
```

Pre-existing breakage — the acceptance job last passed 2026-04-14 and
hadn't run since; the grammar changed in between. Failing run:
https://github.com/cortexapps/terraform-provider-cortex/actions/runs/28393079773/job/84125068576

## Fix

Replace `owners_is_set` with the current equivalent `ownership != null`
across the fixtures and corresponding `TestCheckResourceAttr` assertions
(8 occurrences).

## Verification

Verified green by running the acceptance job against the production API
on the sibling branch in #102 — `--- PASS:
TestAccScorecardResourceComplete (9.53s)`.

Note: the broader fix to run acceptance tests on PRs (currently
main-only) is deferred to a follow-up.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mmaikel mmaikel requested a review from keithfz June 29, 2026 20:19
@mmaikel mmaikel marked this pull request as ready for review June 30, 2026 09:53
@kienan kienan removed their request for review June 30, 2026 16:55

@haowenchan661 haowenchan661 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@mmaikel mmaikel merged commit 51459c0 into main Jul 1, 2026
5 checks passed
@mmaikel mmaikel deleted the fix-scorecard-acceptance-cql branch July 1, 2026 16:15
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.

5 participants