From 8a968618bfcf10bfdd92bc4b960e473f6a340f38 Mon Sep 17 00:00:00 2001 From: Maximilian Rink Date: Sun, 23 Aug 2026 16:22:04 +0200 Subject: [PATCH] ci: add coverage output and nightly workflow with etcd e2e suite Signed-off-by: Maximilian Rink --- .github/workflows/nightly-e2e.yaml | 50 ++++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 7 +++-- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nightly-e2e.yaml diff --git a/.github/workflows/nightly-e2e.yaml b/.github/workflows/nightly-e2e.yaml new file mode 100644 index 00000000..ada5762b --- /dev/null +++ b/.github/workflows/nightly-e2e.yaml @@ -0,0 +1,50 @@ +name: Nightly e2e + +on: + schedule: + - cron: '30 2 * * *' + workflow_dispatch: + +jobs: + unit-coverage: + runs-on: ubuntu-latest + name: Unit tests with coverage + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v7 + - name: Install Go + uses: actions/setup-go@v7 + with: + go-version-file: go.mod + - name: Run tests + run: make unit-tests + - name: Upload coverage + uses: actions/upload-artifact@v7 + with: + name: unit-coverage + path: coverage.out + etcd-e2e: + runs-on: ubuntu-latest + name: Etcd E2E tests + timeout-minutes: 60 + continue-on-error: true + steps: + - name: Ensure fs wont cause issues + run: sudo sysctl fs.inotify.max_user_instances=8192 && sudo sysctl fs.inotify.max_user_watches=524288 + - name: Checkout code + uses: actions/checkout@v7 + - name: Install Go + uses: actions/setup-go@v7 + with: + go-version-file: go.mod + - name: Build image locally + run: make dockerx86Local + - name: Run Etcd tests + run: DOCKER_API_VERSION=1.48 E2E_KEEP_LOGS=true make e2e-tests-etcd + - name: Save logs + uses: actions/upload-artifact@v7 + with: + name: etcd-e2e-logs + path: /tmp/kube-vip-test* + if: always() diff --git a/.gitignore b/.gitignore index e079fe82..e9afc862 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ kube-vip .vscode bin testing/e2e/etcd/certs +coverage.out pkg/etcd/etcd.pid pkg/etcd/etcd-data testing/e2e/e2e.test diff --git a/Makefile b/Makefile index bee35410..79dc384e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ GINKGO_PROCS ?= GINKGO_PARALLEL := $(if $(GINKGO_PROCS),--procs=$(GINKGO_PROCS),-p) BUILDX_CACHE_FLAGS ?= -.PHONY: all build clean install uninstall simplify check run e2e-tests unit-tests integration-tests unit-tests-docker integration-tests-docker +.PHONY: all build clean install uninstall simplify check run e2e-tests unit-tests integration-tests unit-tests-docker integration-tests-docker e2e-tests-etcd all: check install @@ -133,7 +133,7 @@ manifest-test: docker run $(REPOSITORY)/$(TARGET):$(DOCKERTAG) manifest daemonset --interface eth0 --vip 192.168.0.1 --image "$(REPOSITORY)/$(TARGET):$(DOCKERTAG)" --bgp --leaderElection --controlplane --services --inCluster unit-tests: - go test -race ./... + go test -race -coverprofile=coverage.out -covermode=atomic ./... unit-tests-docker: docker run --rm -w /kube-vip -v $$(pwd):/kube-vip -v kube-vip-gomod-cache:/go/pkg/mod -v kube-vip-gobuild-cache:/root/.cache/go-build golang:$(GO_VERSION) sh -c "make unit-tests; status=$$?; chmod 666 coverage.out 2>/dev/null || true; exit $$status" @@ -150,6 +150,9 @@ e2e-tests-rt: get-whoami e2e-tests-bgp: get-whoami get-gobgp GOMAXPROCS=4 TEST_MODE=bgp K8S_IMAGE_PATH=kindest/node:$(K8S_VERSION) E2E_IMAGE_PATH=$(REPOSITORY)/$(TARGET):$(DOCKERTAG) go run github.com/onsi/ginkgo/v2/ginkgo --tags=e2e -v $(GINKGO_PARALLEL) $(GINKGO_ARGS) ./testing/e2e +e2e-tests-etcd: get-whoami + K8S_IMAGE_PATH=kindest/node:$(K8S_VERSION) E2E_IMAGE_PATH=$(REPOSITORY)/$(TARGET):$(DOCKERTAG) go run github.com/onsi/ginkgo/v2/ginkgo --tags=e2e -v $(GINKGO_PARALLEL) $(GINKGO_ARGS) ./testing/e2e/etcd + e2e-tests: e2e-tests-arp e2e-tests-rt e2e-tests-bgp service-tests: