Skip to content

Conversation

@rgarcia
Copy link
Contributor

@rgarcia rgarcia commented Jan 26, 2026

Summary

This PR contributes improvements to the e2e test infrastructure:

Test Infrastructure Improvements

  • ContainerOptions struct - Adds HostAccess option for tests that need --add-host=host.docker.internal:host-gateway to reach services on the host machine
  • runContainerWithOptions() - New function supporting ContainerOptions for flexible container configuration
  • getContainerLogs() - New helper to retrieve the last N lines of container logs for debugging failed tests
  • waitHTTPOrExitWithLogs() - Enhanced wait function that:
    • Captures container logs on failure for easier debugging
    • Periodically logs container status during the wait for better visibility in CI
  • --no-sandbox auto-injection - Automatically adds --no-sandbox to CHROMIUM_FLAGS for CI environments where unprivileged user namespaces may be disabled (e.g., Ubuntu 24.04 GitHub Actions)
  • --tmpfs mode fix - Changed from :size=2g to :size=2g,mode=1777 for proper /dev/shm permissions
  • Sequential test execution - Added -p 1 flag to run tests sequentially, avoiding port conflicts since all e2e tests bind to the same ports (10001, 9222)

Test plan

  • CI passes with all e2e tests
  • Verify tests run sequentially without port conflicts
  • Verify container logs are captured on test failure

- Add ContainerOptions struct with HostAccess for tests needing
  host.docker.internal access
- Add runContainerWithOptions() to support new container options
- Add getContainerLogs() helper to retrieve container logs for debugging
- Add waitHTTPOrExitWithLogs() that captures container logs on failure
  and periodically logs container status during wait
- Auto-inject --no-sandbox flag for CI environments (Ubuntu 24.04 GA)
- Fix tmpfs mode to 1777 for proper /dev/shm permissions
- Run tests sequentially (-p 1) to avoid port conflicts
- Add cookie and IndexedDB persistence tests

These improvements were developed in kernel-images-private and
contributed back to the public upstream.
@rgarcia rgarcia force-pushed the contrib/e2e-test-improvements branch from a03b139 to b67bc9a Compare January 26, 2026 18:28
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Move defer stopContainer immediately after runContainerWithOptions
  to ensure container cleanup even if wait fails
- Fail test if unzip exits with non-zero code instead of just logging
- Check HTTP status code (200) in restartChromium, not just curl exit
- Fail test with clear message if CDP doesn't become ready after 15s
The cookie and IndexedDB persistence tests require kernel-browser
(patched Chromium with session cookie persistence and faster flush).
These patches only exist in the private images, so these tests cannot
run on the public kernel-images repo.
@rgarcia rgarcia changed the title feat: improve e2e test infrastructure and add persistence tests feat: improve e2e test infrastructure Jan 26, 2026
go test -v -race ./...
# Run tests sequentially (-p 1) to avoid port conflicts in e2e tests
# (all e2e tests bind to the same ports: 10001, 9222)
go test -v -race -p 1 ./...
Copy link
Contributor

Choose a reason for hiding this comment

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

can we randomly select available port in the testing suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have a plan ready to go to do this but just trying to fix web-bot-auth stuff before i open a follow up pr for parallelizing these tests and picking a random port

Copy link
Contributor

@hiroTamada hiroTamada left a comment

Choose a reason for hiding this comment

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

one question. But LGTM

@rgarcia rgarcia merged commit 12b2f28 into main Jan 26, 2026
7 of 8 checks passed
@rgarcia rgarcia deleted the contrib/e2e-test-improvements branch January 26, 2026 20:41
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.

3 participants