From d90997e0c208ebc1955ff07dd880e8a342a3f1a7 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Tue, 4 Oct 2022 11:34:38 +0100 Subject: [PATCH] Parallelise and randomize tests Many of the tests take O(1m) to run, and the more specs added the longer the runtime. Parallelising the tests will help defer the day we need to increase the overall timeout. Randomising helps keep the tests independent, by surfacing things that work by coincidence. Enabling either of these requires the use of the Ginkgo command line -- it's not possible to enable them programmatically. So: reinstate the use of `ginkgo` for running tests. Signed-off-by: Michael Bridgen --- .github/workflows/master.yaml | 4 ++++ .github/workflows/release.yaml | 4 ++++ .github/workflows/run-acceptance-tests.yaml | 4 ++++ Makefile | 3 ++- test/suite_test.go | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 0a74c2aa..15b39cb4 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -44,6 +44,10 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.19.x + - name: Install Ginkgo testing framework + run: | + # Do the install from outside the code tree to avoid messing with go.sum + cd /tmp; go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - name: Configure AWS credentials to use in AWS Stack tests uses: aws-actions/configure-aws-credentials@v1 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6e6d1db5..ea1e3ebb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,6 +23,10 @@ jobs: uses: actions/setup-go@v2 with: go-version: "1.19.x" + - name: Install Ginkgo testing framework + run: | + # Do the install from outside the code tree to avoid messing with go.sum + cd /tmp; go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - name: Configure AWS credentials to use in AWS Stack tests uses: aws-actions/configure-aws-credentials@v1 with: diff --git a/.github/workflows/run-acceptance-tests.yaml b/.github/workflows/run-acceptance-tests.yaml index caa1a9a4..c0f9ac53 100644 --- a/.github/workflows/run-acceptance-tests.yaml +++ b/.github/workflows/run-acceptance-tests.yaml @@ -56,6 +56,10 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.19.x + - name: Install Ginkgo testing framework + run: | + # Do the install from outside the code tree to avoid messing with go.sum + cd /tmp; go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - name: Configure AWS credentials to use in AWS Stack tests uses: aws-actions/configure-aws-credentials@v1 with: diff --git a/Makefile b/Makefile index 172e4507..ecbd0057 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,8 @@ push-image: docker push $(IMAGE_NAME):$(VERSION) test: codegen download-test-deps - KUBEBUILDER_ASSETS="$(shell setup-envtest --use-env use -p path)" go test -v ./test/... + KUBEBUILDER_ASSETS="$(shell setup-envtest --use-env use -p path)" \ + ginkgo -nodes=4 --randomizeAllSpecs ./test/... deploy: kubectl apply -f deploy/yaml/service_account.yaml diff --git a/test/suite_test.go b/test/suite_test.go index 3cd14bb5..b76cb456 100644 --- a/test/suite_test.go +++ b/test/suite_test.go @@ -86,7 +86,7 @@ var _ = BeforeSuite(func() { k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme.Scheme, HealthProbeBindAddress: "0", - MetricsBindAddress: "0.0.0.0:8383", + MetricsBindAddress: "0", }) Expect(err).ToNot(HaveOccurred())