Add integration_org_test.rs skeleton for org-only live coverage#173
Open
sdairs wants to merge 1 commit into
Open
Add integration_org_test.rs skeleton for org-only live coverage#173sdairs wants to merge 1 commit into
sdairs wants to merge 1 commit into
Conversation
This was referenced May 15, 2026
32ccfe4 to
efa7803
Compare
Bootstraps the third live test binary so per-area org coverage issues (#153-#157) have somewhere to plug in without coupling to the 15-minute service provisioning lifecycle. - New `tests/integration_org_test.rs` with a single `#[tokio::test]` lifecycle that verifies org access and follows the established FailureRecorder + CleanupRegistry shape. - Extend `TestContext` with `secondary_user_id` populated from `CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID`. Optional in the struct so the existing two suites stay green; `secondary_user_id()` accessor errors with a clear message when the org suite needs it. - Add `org_run_tags` / `org_run_tag_filters` helpers mirroring the postgres pattern. - Extend `CleanupRegistry` with idempotent `register_role` and `register_invitation` (best-effort delete on teardown, 404 swallowed). - Wire the new binary into the cloud-integration workflow and add the secondary user secret to the env block. - Document the new suite + env var in README.md and CLAUDE.md. Closes #152 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
efa7803 to
4fbc39a
Compare
sdairs
added a commit
that referenced
this pull request
May 16, 2026
Adds a Custom Roles CRUD phase to `integration_org_test.rs` that
exercises `organization_roles_get_list`, `organization_role_post`,
`organization_role_get`, `organization_role_patch` and
`organization_role_delete` end-to-end:
- Pre-list captures existing role ids for a sanity assertion that the
created role is genuinely new.
- Create uses `clickhousectl-it-role-{run_id}` so concurrent CI runs
don't collide. The role is registered with `CleanupRegistry` before
any further interaction so teardown still reclaims it on mid-phase
failure.
- Get + list-after-create check the role surfaces with the expected
name, custom type, and permissions.
- Patch replaces the policy permissions; a follow-up GET asserts the
change is observable to real callers.
- Delete unregisters from `CleanupRegistry` on success and verifies a
follow-up GET returns 404. On failure the registration stays put as
best-effort fallback for teardown.
All steps are `NonBlocking`; no downstream phase depends on the role.
Closes #154
Parent: #151
Stacked on #173.
sdairs
added a commit
that referenced
this pull request
May 16, 2026
Adds two phases to `integration_org_test.rs`:
- Members: list/get the secondary user via `member_get_list` +
`member_get`, capture the pre-test role, flip it via `member_update`
(Admin <-> Developer), verify via GET, then eagerly restore. The
capture is registered with `CleanupRegistry::register_member_role_restore`
before any mutating call so teardown always restores the original
role even on panic. `member_delete` is intentionally out of scope —
it would kick the test fixture.
- Invitations: create an invitation to
`alasdair.brown+clickhousectl_{run_id}@clickhouse.com` (catch-all
alias is read by a real inbox but never actioned), register with
`CleanupRegistry::register_invitation`, list/get to confirm, then
cancel (delete) before accept. Accept is UI-only and out of scope.
All steps are NonBlocking per the parent plan (#151) so one CI run
reports every broken endpoint, not just the first.
`CleanupRegistry` gains `register_member_role_restore` /
`unregister_member_role_restore`; teardown runs role restores first
(member_update PATCH) before the existing invitation/role/api-key
deletes. 404s are swallowed (mirrors the existing api-key + invitation
patterns), so an already-restored member doesn't fail the run.
Closes #153
Parent: #151
Stacked on: #173 (#152 bootstrap)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdairs
added a commit
that referenced
this pull request
May 16, 2026
Adds a read-only Org Observability phase to integration_org_test.rs exercising two trivial org-scoped endpoints that previously had no live coverage: - organization_prometheus_get — asserts metrics output is non-empty (mirrors the service-level check in integration_test.rs). - organization_private_endpoint_config_get_list — deprecated endpoint; asserts the call succeeds and deserializes. An empty config is acceptable since the test org may not have a private endpoint in this region. Both steps are NonBlocking; no resources created, no cleanup needed. Closes #157 Parent: #151 Stacked on #173.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bootstraps the third live integration test binary so the per-area org coverage issues (#153–#157) have somewhere to plug in without coupling to the 15-minute ClickHouse service provisioning lifecycle. No real test phases yet — those land in their own issues.
tests/integration_org_test.rswith a single#[tokio::test] #[ignore]lifecycle that verifies org access and follows the existingFailureRecorder+CleanupRegistryshape.TestContextgainssecondary_user_id(populated fromCLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID). Field isOption<String>so the existing two suites stay green; asecondary_user_id()accessor errors with a clear message when the org suite needs it.CleanupRegistryextended with idempotentregister_role/register_invitation(404 swallowed on teardown, mirrors api-key cleanup).org_run_tags/org_run_tag_filtershelpers added for any future org-scoped resource that supports tagging.cloud-integration.ymlwires the new binary as a third step and addsCLICKHOUSE_CLOUD_TEST_SECONDARY_USER_IDto the env block (viasecrets.CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID).Closes #152
Parent: #151
Test plan
cargo build -p clickhouse-cloud-apicleancargo clippy -p clickhouse-cloud-api --test integration_org_test --test integration_postgres_test --lib -- -D warningsclean (pre-existing clippy errors inintegration_test.rsandspec_coverage_test.rsare unrelated and present onmain)cargo test -p clickhouse-cloud-api— all suites green;integration_org_testregisters one ignored lifecycle test as expected--ignoredrun via cloud-integration workflow on this PR (relies onCLICKHOUSE_CLOUD_TEST_SECONDARY_USER_IDbeing added to repo secrets before the third step can succeed)🤖 Generated with Claude Code