Skip to content

Add modern Node.js end-to-end test suite and CI#27

Draft
tg123 with Copilot wants to merge 2 commits into
masterfrom
copilot/modern-e2e-tests
Draft

Add modern Node.js end-to-end test suite and CI#27
tg123 with Copilot wants to merge 2 commits into
masterfrom
copilot/modern-e2e-tests

Conversation

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown

The repo only had legacy Perl Test::Nginx::Socket tests and no CI. This adds a self-contained, modern e2e suite that builds nginx with the module and drives the public WebSocket endpoint with a standards-compliant client, runnable locally and in GitHub Actions.

Changes

  • Test harness (e2e/harness.mjs) — spins up a TCP echo upstream (stand-in for a websockify/VNC backend) and an nginx instance built with the module on ephemeral ports, with config validation and automatic teardown.
  • Tests (e2e/test/websockify.test.mjs) — Node's built-in node:test runner + ws, covering: binary round-trip, base64 decode/re-encode, subprotocol preference (binary over base64), large (1 MiB) streaming, rejection of unsupported subprotocols, and dead-upstream teardown.
  • Build helper (e2e/build-nginx.sh) — compiles a configurable nginx version (NGINX_VERSION, nginx.org with GitHub mirror fallback) with the module added; prints the binary path.
  • CI (.github/workflows/e2e.yml) — runs the suite on push/PR across nginx 1.24.0 / 1.25.3 / 1.27.3, with permissions: contents: read.
  • Docse2e/README.md plus a Testing section in README.md.
cd e2e
npm install
export NGINX_BIN="$(./build-nginx.sh)"   # or point at an existing build
npm test

Note on observed behavior

With an unreachable upstream the module completes the WebSocket handshake (101) and then closes abnormally (1006) rather than returning 502. The dead-upstream test asserts against this actual behavior; worth confirming it is intended.

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