From 677be9aab2cef9673d12c7f857042208b2c3cc88 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 6 May 2024 23:21:17 -0700 Subject: [PATCH] chore: add tailnet integration test CI job (#13181) --- .github/workflows/ci.yaml | 29 +++++++++++++++++++++++++++++ Makefile | 12 ++++++++++++ 2 files changed, 41 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ce41c5088..f958663167 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,6 +40,7 @@ jobs: gomod: ${{ steps.filter.outputs.gomod }} offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }} offlinedocs: ${{ steps.filter.outputs.offlinedocs }} + tailnet-integration: ${{ steps.filter.outputs.tailnet-integration }} steps: - name: Checkout uses: actions/checkout@v4 @@ -107,6 +108,10 @@ jobs: - ".github/workflows/ci.yaml" offlinedocs: - "offlinedocs/**" + tailnet-integration: + - "tailnet/**" + - "go.mod" + - "go.sum" - id: debug run: | @@ -384,6 +389,30 @@ jobs: with: api-key: ${{ secrets.DATADOG_API_KEY }} + # Tailnet integration tests only run when the `tailnet` directory or `go.sum` + # and `go.mod` are changed. These tests are to ensure we don't add regressions + # to tailnet, either due to our code or due to updating dependencies. + # + # These tests are skipped in the main go test jobs because they require root + # and mess with networking. + test-go-tailnet-integration: + runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} + needs: changes + # Unnecessary to run on main for now + if: needs.changes.outputs.tailnet-integration == 'true' || needs.changes.outputs.ci == 'true' + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Go + uses: ./.github/actions/setup-go + + - name: Run Tests + run: make test-tailnet-integration + test-js: runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} needs: changes diff --git a/Makefile b/Makefile index dd31c10fff..7a04072964 100644 --- a/Makefile +++ b/Makefile @@ -827,6 +827,18 @@ test-race: gotestsum --junitfile="gotests.xml" -- -race -count=1 ./... .PHONY: test-race +test-tailnet-integration: + env \ + CODER_TAILNET_TESTS=true \ + CODER_MAGICSOCK_DEBUG_LOGGING=true \ + TS_DEBUG_NETCHECK=true \ + GOTRACEBACK=single \ + go test \ + -exec "sudo -E" \ + -timeout=5m \ + -count=1 \ + ./tailnet/test/integration + # Note: we used to add this to the test target, but it's not necessary and we can # achieve the desired result by specifying -count=1 in the go test invocation # instead. Keeping it here for convenience.