From d0e7ca8edd4372217b90e865af98c76fb968685d Mon Sep 17 00:00:00 2001 From: Ryan Maleki Date: Sat, 12 Mar 2022 16:22:17 -0800 Subject: [PATCH] Add nightly flaky test finder (#1499) * add CI script for running tests multiple times to find flaky tests --- .github/workflows/deflake.yml | 26 ++++++++++++++++++++++++++ Makefile | 11 ++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deflake.yml diff --git a/.github/workflows/deflake.yml b/.github/workflows/deflake.yml new file mode 100644 index 000000000000..6603d63f3c66 --- /dev/null +++ b/.github/workflows/deflake.yml @@ -0,0 +1,26 @@ +name: Deflake +on: + schedule: + - cron: '22 18 * * 0' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + ~/go/bin/ + ~/.kubebuilder/bin/k8s + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + - name: Running tests 10 times to find flaky tests + run: | + make toolchain + make deflake + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 438a9ae49677..e89b8e274d78 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,16 @@ ci: toolchain verify licenses battletest ## Run all steps used by continuous int test: ## Run tests ginkgo -r -battletest: ## Run stronger tests +strongertests: # Run randomized, parallelized, racing, code coveraged, tests ginkgo -r \ - -cover -coverprofile=coverage.out -outputdir=. -coverpkg=./pkg/... \ - --randomizeAllSpecs --randomizeSuites -race + -cover -coverprofile=coverage.out -outputdir=. -coverpkg=./pkg/... \ + --randomizeAllSpecs --randomizeSuites -race + +deflake: + for i in {1..10}; do make strongertests || exit 1; done + +battletest: strongertests go tool cover -html coverage.out -o coverage.html verify: codegen ## Verify code. Includes dependencies, linting, formatting, etc