fix(localscale): harden vitess test isolation#147
Draft
aparajon wants to merge 7 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens LocalScale Vitess test isolation by making /admin/reset-state a strict isolation boundary that cancels in-flight deploy work, resets Vitess Online DDL state, and closes branch proxy connections so repeated local/CI runs are deterministic.
Changes:
- Expanded
/admin/reset-stateto cancel active deploy execution, unthrottle/cancel/wait/cleanup Vitess migrations, close branch proxies, drop branch DBs, and reset metadata. - Updated LocalScale integration/e2e reset helpers and tests to use the admin reset boundary and unique object names to avoid cross-test collisions.
- Improved proxy shutdown behavior by tracking and actively closing in-flight client connections; added focused unit tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/localscale/server.go | Implements stronger ResetState semantics; adds deploy-execution cancellation tracking and reset diagnostics; closes only branch proxies during reset. |
| pkg/localscale/server_integration_test.go | Switches test cleanup to call ResetState and adds deploy diagnostics logging on failures/timeouts. |
| pkg/localscale/server_deploy_integration_test.go | Adds coverage for reset immediately after deploy submit and makes DDL object names unique per test. |
| pkg/localscale/helpers.go | Refactors shard-targeted vtgate connection logic and improves Online DDL readiness checks. |
| pkg/localscale/handlers_deploy.go | Registers/cancels active deploy execution contexts so reset can interrupt deploy work. |
| pkg/localscale/handlers_actions.go | Updates Vitess migration ALTER logic to use shard-targeted connections. |
| pkg/localscale/proxy.go | Tracks active client connections and closes them during proxy shutdown to prevent leaked connections across resets. |
| pkg/localscale/proxy_test.go | Adds unit tests for preserving edge proxies and for branch proxy connection tracking/close behavior. |
| pkg/localscale/README.md | Documents reset-state as the test isolation boundary and expands its described behavior. |
| pkg/localscale/approval_integration_test.go | Makes branch/DDL identifiers unique to avoid collisions across runs. |
| pkg/e2eutil/localscale.go | Removes the old metadata-query-based “reset deploy requests” helper in favor of admin reset-state. |
| e2e/local/helpers_test.go | Updates e2e reset helper to call /admin/reset-state and surface response bodies on failure. |
| e2e/local/vitess_test.go | Makes reset failures fatal with diagnostics; adds metadata-query diagnostics helper; fixes terminal-state assertion helper. |
| pkg/api/progress_handlers_test.go | Adds focused unit test for changeTypeToString() mapping VSchema change type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+764
to
+765
| result = append(result, fmt.Sprintf("keyspace=%s uuid=%s status=%s context=%s message=%s", | ||
| keyspace, colMap["uuid"], status, colMap["migration_context"], colMap["message"])) |
Comment on lines
+420
to
+424
| for target := range targets { | ||
| stmt := fmt.Sprintf("ALTER VITESS_MIGRATION %s ALL", action) | ||
| err := func() error { | ||
| conn, cleanup, err := s.vtgateTargetConn(ctx, backend, target.keyspace, target.shard) | ||
| if err != nil { |
Comment on lines
176
to
178
| p.connWg.Go(func() { | ||
| defer untrack() | ||
| p.handleConn(client) |
7dfbf9c to
dd7e1ee
Compare
dd7e1ee to
c80ee7b
Compare
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.
Why
LocalScale Vitess tests could leak active deploy work and proxy connections across resets, making repeated local and CI runs nondeterministic.
What
/admin/reset-statecancel active deploy work, clear Vitess online DDL state, and close branch proxiesRisk Assessment
Medium-low - this mostly affects LocalScale test/dev reset behavior. Runtime changes are scoped to LocalScale admin APIs and proxy cleanup.
🤖 Generated with Codex on behalf of @aparajon.