Skip to content

fix(localscale): harden vitess test isolation#147

Draft
aparajon wants to merge 7 commits into
mainfrom
aparajon/vitess-e2e-cleanup-isolation
Draft

fix(localscale): harden vitess test isolation#147
aparajon wants to merge 7 commits into
mainfrom
aparajon/vitess-e2e-cleanup-isolation

Conversation

@aparajon
Copy link
Copy Markdown
Collaborator

@aparajon aparajon commented May 22, 2026

Why

LocalScale Vitess tests could leak active deploy work and proxy connections across resets, making repeated local and CI runs nondeterministic.

What

  • Make /admin/reset-state cancel active deploy work, clear Vitess online DDL state, and close branch proxies
  • Update local e2e reset helpers to use the admin reset boundary
  • Add focused reset/proxy coverage and make LocalScale tests use isolated object names

Risk 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.

Copilot AI review requested due to automatic review settings May 22, 2026 20:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-state to 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 thread pkg/localscale/server.go
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 thread pkg/localscale/proxy.go
Comment on lines 176 to 178
p.connWg.Go(func() {
defer untrack()
p.handleConn(client)
@aparajon aparajon force-pushed the aparajon/vitess-e2e-cleanup-isolation branch 3 times, most recently from 7dfbf9c to dd7e1ee Compare May 28, 2026 14:47
@aparajon aparajon force-pushed the aparajon/vitess-e2e-cleanup-isolation branch from dd7e1ee to c80ee7b Compare May 28, 2026 15:01
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.

2 participants