Skip to content

Add integration_org_test.rs skeleton for org-only live coverage#173

Open
sdairs wants to merge 1 commit into
md/add-clickpipes-supportfrom
issue-152-bootstrap-org-integration
Open

Add integration_org_test.rs skeleton for org-only live coverage#173
sdairs wants to merge 1 commit into
md/add-clickpipes-supportfrom
issue-152-bootstrap-org-integration

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented May 15, 2026

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.

  • New tests/integration_org_test.rs with a single #[tokio::test] #[ignore] lifecycle that verifies org access and follows the existing FailureRecorder + CleanupRegistry shape.
  • TestContext gains secondary_user_id (populated from CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID). Field is Option<String> so the existing two suites stay green; a secondary_user_id() accessor errors with a clear message when the org suite needs it.
  • CleanupRegistry extended with idempotent register_role / register_invitation (404 swallowed on teardown, mirrors api-key cleanup).
  • org_run_tags / org_run_tag_filters helpers added for any future org-scoped resource that supports tagging.
  • Workflow cloud-integration.yml wires the new binary as a third step and adds CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID to the env block (via secrets.CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID).
  • README + CLAUDE.md updated to mention the new suite and env var.

Closes #152
Parent: #151

Test plan

  • cargo build -p clickhouse-cloud-api clean
  • cargo clippy -p clickhouse-cloud-api --test integration_org_test --test integration_postgres_test --lib -- -D warnings clean (pre-existing clippy errors in integration_test.rs and spec_coverage_test.rs are unrelated and present on main)
  • cargo test -p clickhouse-cloud-api — all suites green; integration_org_test registers one ignored lifecycle test as expected
  • Live --ignored run via cloud-integration workflow on this PR (relies on CLICKHOUSE_CLOUD_TEST_SECONDARY_USER_ID being added to repo secrets before the third step can succeed)

🤖 Generated with Claude Code

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 16, 2026

CLA assistant check
All committers have signed the CLA.

@sdairs sdairs changed the base branch from main to md/add-clickpipes-support May 16, 2026 11:00
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>
@sdairs sdairs force-pushed the issue-152-bootstrap-org-integration branch from efa7803 to 4fbc39a Compare May 16, 2026 11:24
@sdairs sdairs temporarily deployed to cloud-integration May 16, 2026 11:24 — with GitHub Actions Inactive
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.
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.

Add integration_org_test.rs skeleton for org-only live coverage

2 participants