mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-13 17:47:33 -04:00
ssh/tailssh: speed up SSH integration tests
Parallelize the SSH integration tests across OS targets and reduce per-container overhead: - CI: use GitHub Actions matrix strategy to run all 4 OS containers (ubuntu:focal, ubuntu:jammy, ubuntu:noble, alpine:latest) in parallel instead of sequentially (~4x wall-clock improvement) - Makefile: run docker builds in parallel for local dev too - Dockerfile: consolidate ~20 separate RUN commands into 5 (one per test phase), eliminating Docker layer overhead. Combine test binary invocations where no state mutation is needed between them. Fix a bug where TestDoDropPrivileges was silently not being run (was passed as a second positional arg to -test.run instead of using regex alternation). - TestMain: replace tail -F + 2s sleep with synchronous log read, eliminating 2s overhead per test binary invocation. Set debugTest once in TestMain instead of redundantly in each test function. - session.read(): close channel on EOF so non-shell tests return immediately instead of waiting for the 1s silence timeout. Updates #19244 Change-Id: I2cc8588964fbce0dd7b654fb94e7ff33440b8584 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
cfed69f3ed
commit
e2fa9ff140
24
.github/workflows/ssh-integrationtest.yml
vendored
24
.github/workflows/ssh-integrationtest.yml
vendored
@@ -1,5 +1,5 @@
|
||||
# Run the ssh integration tests with `make sshintegrationtest`.
|
||||
# These tests can also be running locally.
|
||||
# Run the ssh integration tests in various Docker containers.
|
||||
# These tests can also be run locally via `make sshintegrationtest`.
|
||||
name: "ssh-integrationtest"
|
||||
|
||||
concurrency:
|
||||
@@ -15,9 +15,25 @@ on:
|
||||
jobs:
|
||||
ssh-integrationtest:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- base: "ubuntu:focal"
|
||||
tag: "ssh-ubuntu-focal"
|
||||
- base: "ubuntu:jammy"
|
||||
tag: "ssh-ubuntu-jammy"
|
||||
- base: "ubuntu:noble"
|
||||
tag: "ssh-ubuntu-noble"
|
||||
- base: "alpine:latest"
|
||||
tag: "ssh-alpine-latest"
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Run SSH integration tests
|
||||
- name: Build test binaries
|
||||
run: |
|
||||
make sshintegrationtest
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./tool/go test -tags integrationtest -c ./ssh/tailssh -o ssh/tailssh/testcontainers/tailssh.test
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./tool/go build -o ssh/tailssh/testcontainers/tailscaled ./cmd/tailscaled
|
||||
- name: Run SSH integration tests (${{ matrix.base }})
|
||||
run: |
|
||||
docker build --build-arg="BASE=${{ matrix.base }}" -t "${{ matrix.tag }}" ssh/tailssh/testcontainers
|
||||
|
||||
Reference in New Issue
Block a user