Skip to content

Convert bats E2E tests to Go + Ginkgo#439

Open
ambient-code[bot] wants to merge 4 commits intomainfrom
convert-bats-to-ginkgo-436
Open

Convert bats E2E tests to Go + Ginkgo#439
ambient-code[bot] wants to merge 4 commits intomainfrom
convert-bats-to-ginkgo-436

Conversation

@ambient-code
Copy link
Copy Markdown
Contributor

@ambient-code ambient-code bot commented Apr 8, 2026

Summary

  • Converts all 5 bats E2E test files to Go + Ginkgo test suites in e2e/test/
  • Shared utilities in utils.go for command execution, process tracking, exporter lifecycle, and debug logging
  • Updated e2e/run-e2e.sh and e2e/compat/run.sh to use the ginkgo runner instead of bats
  • Ginkgo label structure enables running specific test subsets: core, hooks, direct-listener, compat, old-client, old-controller, operator-only
  • Supports E2E_TEST_NS, PYTHON_VENV, PYTHON_OLD_VENV environment variables as specified in the issue

Test file mapping

Bats file Ginkgo file Label
tests.bats e2e_test.go core
tests-hooks.bats hooks_test.go hooks
tests-direct-listener.bats direct_listener_test.go direct-listener
compat/tests-old-client.bats compat_old_client_test.go compat, old-client
compat/tests-old-controller.bats compat_old_controller_test.go compat, old-controller

Workflow file changes

The .github/workflows/e2e.yaml workflow currently invokes make e2e-run and make e2e-compat-run which call the shell scripts that have been updated. The workflow should work as-is since the runner scripts now invoke ginkgo instead of bats. However, the following optional workflow improvements could be made:

  • The bats installation step in setup-e2e.sh is no longer needed for the test runner (though it may still be needed for other setup steps)
  • Consider adding GINKGO_LABEL_FILTER support to the workflow matrix for selective test runs

Test plan

  • Verify go vet and go build pass in e2e/test/ (verified locally)
  • Run make e2e-run in a cluster environment to validate the converted tests
  • Run make e2e-compat-run COMPAT_TEST=old-controller to validate compat tests
  • Run make e2e-compat-run COMPAT_TEST=old-client to validate old-client tests
  • Verify label filtering works: GINKGO_LABEL_FILTER=hooks make e2e-run

Closes #436

🤖 Generated with Claude Code

Convert all 5 bats E2E test files (tests.bats, tests-hooks.bats,
tests-direct-listener.bats, compat/tests-old-client.bats,
compat/tests-old-controller.bats) to Go + Ginkgo test suites.

Key changes:
- New e2e/test/ Go module with ginkgo/gomega dependencies
- utils.go: shared helpers for command execution, process tracking,
  exporter lifecycle management, and debug logging
- e2e_test.go: core tests (login, CRUD, leases, connectivity)
- hooks_test.go: hook execution tests (groups A-H)
- direct_listener_test.go: direct TCP listener mode tests
- compat_old_client_test.go: old client compatibility tests
- compat_old_controller_test.go: old controller compatibility tests
- Updated run-e2e.sh and compat/run.sh to use ginkgo runner

Label structure for subset filtering:
- "core" - main test suite
- "hooks" - hook execution tests
- "direct-listener" - direct listener tests
- "compat" - all compatibility tests
- "old-client" - old client compat tests
- "old-controller" - old controller compat tests
- "operator-only" - tests requiring operator deployment

Environment variables:
- E2E_TEST_NS / JS_NAMESPACE - test namespace
- PYTHON_VENV / PYTHON_OLD_VENV - python venv paths
- OLD_JMP - path to old jmp binary for compat tests
- REPO_ROOT - repository root directory

Closes #436

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 8, 2026

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 51feb3b
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69d6ecfd8531e600083496a1
😎 Deploy Preview https://deploy-preview-439--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f6e7be3b-20c5-4f01-902e-042f9f1b1a08

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch convert-bats-to-ginkgo-436

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mangelajo mangelajo requested review from kirkbrauer and mangelajo and removed request for kirkbrauer April 8, 2026 20:28
Ambient Code Bot and others added 2 commits April 8, 2026 22:06
- Fix yq stdout contamination: use RunCmdSplit in Yq helper to separate
  stdout from stderr, preventing Go toolchain switching messages from
  polluting extracted values. Replace inline bash+yq pipe with MustYq
  in the lease transfer test.

- Fix hooks test timing: replace fixed time.Sleep + immediate assertion
  with Gomega Eventually (10s timeout) when checking that exporter
  processes have exited, avoiding flaky failures on slow CI.

- Fix direct listener connection refused: add port-release wait in
  AfterEach so the next test does not attempt to bind port 19090 before
  the OS has fully released it from the previous exporter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd increase process exit timeouts

The "afterLease hook runs on exporter shutdown" test was sending SIGKILL
(via cmd.Process.Kill()) which prevents cleanup hooks from running, then
asserting the afterLease hook output was present. Changed to SIGTERM to
allow the exporter's cleanup handler to execute.

Also increased IsProcessRunning timeouts from 10s to 30s for the B3 and
C2 hook tests, as ARM CI runners need more time for exporter shutdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ambient-code
Copy link
Copy Markdown
Contributor Author

ambient-code bot commented Apr 8, 2026

CI Fix: e2e test failures on ARM

Two e2e tests were failing on ubuntu-24.04-arm (and causing cascading skips/timeouts on ubuntu-24.04):

1. direct_listener_test.go — "afterLease hook runs on exporter shutdown"

Root cause: The test used cmd.Process.Kill() (SIGKILL) to stop the exporter, but then asserted that the afterLease cleanup hook had run. SIGKILL terminates the process immediately without allowing any signal handlers or cleanup hooks to execute.

Fix: Changed to cmd.Process.Signal(syscall.SIGTERM) so the exporter's cleanup handler can run the afterLease hook before exiting. Also wrapped the stderr log assertion in Eventually to allow time for the hook output to be flushed.

2. hooks_test.go — "B3: beforeLease onFailure=exit shuts down exporter" (and C2)

Root cause: The Eventually timeout for IsProcessRunning() was 10 seconds, which is too tight for ARM runners where process shutdown is slower.

Fix: Increased the timeout from 10s to 30s and the poll interval from 500ms to 1s for both B3 and C2 tests.


Pushed as commit 7ece585.

🤖 Generated with Claude Code

…n ARM

When StartExporterSingle starts a child process via cmd.Start() without
ever calling cmd.Wait(), the process becomes a zombie after it exits.
Signal(0) returns nil for zombies, so IsProcessRunning() never detects
the exit — causing tests B3 and C2 to time out waiting for the exporter
to stop (especially on slower ARM runners).

Fix by spawning a background goroutine that calls cmd.Wait() to reap
the child process, allowing Signal(0) to correctly report it as gone.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Convert bats E2E tests to ginkgo

0 participants