Skip to content

Add scaling_schedule round-trip coverage to service suite#178

Open
sdairs wants to merge 3 commits into
issue-168-postgres-prometheus-and-pg-configfrom
issue-169-scaling-schedule-roundtrip
Open

Add scaling_schedule round-trip coverage to service suite#178
sdairs wants to merge 3 commits into
issue-168-postgres-prometheus-and-pg-configfrom
issue-169-scaling-schedule-roundtrip

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented May 15, 2026

Summary

  • Adds a Beta Scaling Schedule phase to integration_test.rs covering scaling_schedule_get, scaling_schedule_upsert, and scaling_schedule_replace (parent Close live API integration test coverage gap #151).
  • Pre-state is captured via GET, an inert window is upserted then PATCH-replaced with another inert window, and every change is GET-verified.
  • Pre-state restore is registered with CleanupRegistry so it runs in cleanup, not in the test body — a mid-phase failure still rolls back the synthetic schedule.

Why the schedules are inert

The synthetic entries use minReplicas=maxReplicas=1 and min/maxReplicaMemoryGb=8, identical to the current service state (the previous "scale in to 1 replica" step). Even if the window happens to be active when the test runs, the entry produces no scaling action — it's effectively a no-op. As a second line of defence, each window is one hour wide (1-2 UTC for upsert, 2-3 UTC for replace) and applies on Sunday only.

Test plan

  • cargo build -p clickhouse-cloud-api
  • cargo clippy -p clickhouse-cloud-api --tests (no new warnings introduced by these changes)
  • cargo test -p clickhouse-cloud-api — 86+6+1 tests pass, ignored live tests still skipped
  • Cloud integration test exercises the new phase end-to-end on PR CI

Closes #169

@sdairs sdairs requested a review from iskakaushik as a code owner May 15, 2026 16:00
@sdairs sdairs had a problem deploying to cloud-integration May 15, 2026 16:01 — with GitHub Actions Failure
@sdairs sdairs had a problem deploying to cloud-integration May 15, 2026 19:50 — with GitHub Actions Failure
@sdairs sdairs had a problem deploying to cloud-integration May 15, 2026 21:37 — with GitHub Actions Failure
@sdairs sdairs had a problem deploying to cloud-integration May 15, 2026 21:51 — with GitHub Actions Failure
@sdairs sdairs temporarily deployed to cloud-integration May 15, 2026 22:46 — with GitHub Actions Inactive
@sdairs sdairs force-pushed the issue-169-scaling-schedule-roundtrip branch from da3e20f to 4a614f9 Compare May 16, 2026 11:44
@sdairs sdairs changed the base branch from main to md/add-clickpipes-support May 16, 2026 11:44
@sdairs sdairs temporarily deployed to cloud-integration May 16, 2026 11:44 — with GitHub Actions Inactive
sdairs and others added 3 commits May 16, 2026 13:45
Adds a Scaling Schedule phase to integration_test.rs covering the Beta
scaling_schedule_{get,upsert,replace} endpoints. The phase captures
pre-state, upserts an inert window, GETs to verify the round-trip,
PATCH-replaces with a different inert window, and GETs again. The
schedule entries use replica counts and memory identical to the current
service state (1 replica, 8 GB) so they're guaranteed no-ops even if
the window happens to be active during the test run.

Pre-state restore is wired through CleanupRegistry as a cleanup step,
not a test-body step, so a mid-phase failure still rolls back the
synthetic schedule. The restore tolerates 404 in case the in-test
delete already removed the service.

Closes #169
Fresh services have no autoscaling schedule configured, so
`scaling_schedule_get` returns 404 rather than an empty schedule.
The pre-state step was bubbling that 404 via `?`, failing the run
under CI's fail-fast NonBlocking mode.

Catch the 404 inside the closure and substitute
`ScalingSchedule::default()` so the round-trip still exercises
upsert/replace. Skip restore registration when the captured
pre-state is empty — the API rejects upserts with `entries: []`,
and there is nothing meaningful to restore (the service-delete
teardown handles synthetic entries anyway).
The scalingSchedule endpoint dropped its PATCH operation; only GET, POST,
and DELETE remain. The library-side swap (replace_replace → schedule_delete,
plus the dropped ScalingSchedulePatchRequest) now lives in the
issue-168-postgres-prometheus-and-pg-config base branch (PR #186); this
commit just reworks the integration round-trip to delete + assert 404.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sdairs sdairs force-pushed the issue-169-scaling-schedule-roundtrip branch from 4a614f9 to 038dedf Compare May 16, 2026 12:48
@sdairs sdairs requested a deployment to cloud-integration May 16, 2026 12:48 — with GitHub Actions In progress
@sdairs sdairs changed the base branch from md/add-clickpipes-support to issue-168-postgres-prometheus-and-pg-config May 16, 2026 12:48
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.

Cover scaling_schedule_get / replace / upsert in service integration suite

1 participant