From 595e4d1873823273b4bef1ef224e8f0842d37820 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Fri, 30 Jun 2023 11:37:37 +1000 Subject: [PATCH] Mask acceptance test flakiness with retries (#387) --- .github/workflows/acctest.yml | 9 +++++++-- Makefile | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/acctest.yml b/.github/workflows/acctest.yml index 3610fae..4a76d39 100644 --- a/.github/workflows/acctest.yml +++ b/.github/workflows/acctest.yml @@ -33,6 +33,11 @@ jobs: go-version-file: "go.mod" check-latest: true + # The acceptance tests sometimes timeout for some unknown reason. - name: TF acceptance tests - timeout-minutes: 20 - run: make testacc UNIFI_STDOUT=true UNIFI_VERSION=${{ matrix.unifi_download_url && 'beta' || matrix.unifi_version }} UNIFI_DOWNLOAD_URL=${{ matrix.unifi_download_url }} + uses: "nick-fields/retry@v2" + with: + timeout_minutes: 20 + max_attempts: 3 + command: make testacc TEST_TIMEOUT=1h UNIFI_STDOUT=true UNIFI_VERSION=${{ matrix.unifi_download_url && 'beta' || matrix.unifi_version }} UNIFI_DOWNLOAD_URL=${{ matrix.unifi_download_url }} + retry_on: "timeout" diff --git a/Makefile b/Makefile index c7145e8..c8a21ab 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ -TEST ?= ./... -TESTARGS ?= -TEST_COUNT ?= 1 +TEST ?= ./... +TESTARGS ?= +TEST_COUNT ?= 1 +TEST_TIMEOUT ?= 10m .PHONY: default default: build @@ -11,4 +12,4 @@ build: .PHONY: testacc testacc: - TF_ACC=1 go test $(TEST) -v -count=$(TEST_COUNT) $(TESTARGS) + TF_ACC=1 go test $(TEST) -v -count $(TEST_COUNT) -timeout $(TEST_TIMEOUT) $(TESTARGS)