chore(nodes): add a master+node end-to-end harness and CI job
Node sync had no test with two real panels: the single-panel tests either call the node's controller in-process or hand-set the node-sync scope, so823db059shipped a regression no test could see (an admin-token node dropped every client and enable flag its master pushed). internal/nodee2e starts a master and a node as separate panel processes (the DB is a process-wide global, so one process cannot be both) and walks 17 operations per enrollment scope (admin token, node-sync token): adopt, create/edit on the master, small and bulk attach, client disable, detach, client delete, inbound disable, traffic pull and reset, node-side delete mirrored centrally (#6219), master-side delete, node down, node-lost inbound re-created, create/edit while down, node disabled on the master, and selected sync mode leaving unselected inbounds alone. Against the build before2ffc694ait fails 6 cells for an admin-token node and 1 for a node-sync one; on main all 34 pass, on Windows and on Linux. `make node-e2e` builds a stub-dist binary and runs it; ci.yml runs it as its own job where a SKIP fails the build. Xray is not started, so cells assert the node's stored state, not traffic through the core.
This commit is contained in:
1 parent
2ffc694a6d
commit
f843fe5570
5 files changed
+724
-5
No files matched your search
@@ -141,6 +141,22 @@ jobs:
|
||||
# internal/web/service runs ~10x slower under -race and overruns the 10m default.
|
||||
go test -race -shuffle=on -count=1 -timeout 25m $(cat /tmp/go-packages.txt)
|
||||
|
||||
# A real master and node panel, each its own process, driven through node sync.
|
||||
# A SKIP here means the binary was never handed over, so it fails the job.
|
||||
node-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Master + node end to end
|
||||
run: |
|
||||
set -o pipefail
|
||||
make node-e2e 2>&1 | tee /tmp/node-e2e.log
|
||||
if grep -q -- '--- SKIP' /tmp/node-e2e.log; then echo "node-e2e skipped"; exit 1; fi
|
||||
|
||||
# Brief native-fuzz smoke on the security-/parser-critical decoders. Each runs the
|
||||
# generated corpus plus 30s of exploration; a crash here is a real input-handling bug.
|
||||
fuzz-smoke:
|
||||
|
||||
@@ -160,9 +160,10 @@ file locations when it can answer in one hop.
|
||||
`-race`); `httptest` for HTTP. Keep `database.InitDB` for reopening a file or
|
||||
migrating a hand-built legacy DB. `internal/sub`'s `initSubDB(t)` is the template.
|
||||
- Code must pass `golangci-lint run` (gofumpt + goimports formatting): `make lint`.
|
||||
- Postgres, xray-gRPC-e2e and scale tests `t.Skip` unless `XUI_TEST_PG_DSN`,
|
||||
`XUI_DB_TYPE`+`XUI_DB_DSN`, `XRAY_E2E_BINARY` or `XUI_SCALE_TEST` is set — a
|
||||
green `go test ./...` does not mean those paths ran.
|
||||
- Postgres, xray-gRPC-e2e, master+node and scale tests `t.Skip` unless
|
||||
`XUI_TEST_PG_DSN`, `XUI_DB_TYPE`+`XUI_DB_DSN`, `XRAY_E2E_BINARY`,
|
||||
`XUI_NODE_E2E_BINARY` or `XUI_SCALE_TEST` is set — a green `go test ./...`
|
||||
does not mean those paths ran.
|
||||
|
||||
## Frontend conventions (summary; full version in frontend/CLAUDE.md)
|
||||
- Ant Design 6 only — no Tailwind/shadcn. Targeted tweaks, not rewrites.
|
||||
@@ -191,9 +192,11 @@ reads as a broken repo, not a missing step. Run `make dist-stub` once; every
|
||||
make verify # gen-check + lint + typecheck + test + build + build-storybook
|
||||
|
||||
That is the *fast* gate, not all of CI. `ci.yml` also runs `make race`,
|
||||
`make vulncheck`, a live-Postgres job (where a SKIP counts as a failure) and a
|
||||
`make vulncheck`, a live-Postgres job (where a SKIP counts as a failure),
|
||||
`make node-e2e` (a real master and node panel, `internal/nodee2e/`) and a
|
||||
30s fuzz smoke on `FuzzParseLink`/`FuzzDecodeCertPin` — run those locally when
|
||||
you touch DB/dialect or parser code.
|
||||
you touch DB/dialect, node sync or parser code. A new node-sync behaviour gets
|
||||
a cell in `internal/nodee2e/node_sync_test.go`.
|
||||
|
||||
Common targets: `make gen` (regenerate Zod/OpenAPI), `make lint` (Go + frontend),
|
||||
`make test` (Go `-shuffle=on` + frontend), `make race`, `make build`. See `Makefile`.
|
||||
|
||||
@@ -58,6 +58,13 @@ test-go: dist-stub ## Go tests (shuffle, no cache)
|
||||
race: dist-stub ## Go tests with the race detector (needs a C compiler)
|
||||
go test -race -shuffle=on -count=1 -timeout 25m $(GO_PKGS)
|
||||
|
||||
.PHONY: node-e2e
|
||||
# Two real panel processes (master + node); test-go only runs nodee2e as a skip.
|
||||
NODE_E2E_BIN = $(CURDIR)/.cache/node-e2e/x-ui$(shell go env GOEXE)
|
||||
node-e2e: dist-stub ## Master+node sync end to end with two real panel processes
|
||||
go build -o $(NODE_E2E_BIN) .
|
||||
XUI_NODE_E2E_BINARY=$(NODE_E2E_BIN) go test -count=1 -timeout 20m -v ./internal/nodee2e/
|
||||
|
||||
.PHONY: test-fe
|
||||
test-fe: ## Frontend tests (vitest)
|
||||
cd $(FRONTEND) && npm test
|
||||
|
||||
Loaded 3 of 5 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user