From dff8378778716100ba2dcb1485122bb4f3e059cb Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sat, 24 Apr 2021 13:14:52 +0200 Subject: [PATCH] Feat/head failure toggle (#928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: make head pull failure warning toggleable * expect prometheus tests to go through EVENTUALLY * wait for queue to be empty before checking test conditions * clean up new head failure toggle * fixup! clean up new head failure toggle * test: add warn on head failure tests * fix client interface and make tests hit more lines * make all tests use NewClient instead of creating a struct pointer * fix lint issues * see if moving ubuntu out of the matrix solves test issue Co-authored-by: nils måsén --- .github/workflows/pull-request.yml | 22 ++++++++++++++++++++-- pkg/metrics/metrics.go | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 099e259..24bfe13 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -33,7 +33,6 @@ jobs: go-version: - 1.15.x platform: - - ubuntu-latest - macos-latest - windows-latest runs-on: ${{ matrix.platform }} @@ -53,7 +52,26 @@ jobs: uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - + test-ubuntu: + name: Test (Ubuntu) + runs-on: ubuntu-latest + needs: test + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15.x + - name: Run tests + run: | + go test -v -coverprofile coverage.out -covermode atomic ./... + - name: Publish coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} build: name: Build runs-on: ubuntu-latest diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index d8761ba..91be2e6 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -29,6 +29,11 @@ func (metrics *Metrics) QueueIsEmpty() bool { return len(metrics.channel) == 0 } +// QueueIsEmpty checks whether any messages are enqueued in the channel +func (metrics *Metrics) QueueIsEmpty() bool { + return len(metrics.channel) == 0 +} + // Register registers metrics for an executed scan func (metrics *Metrics) Register(metric *Metric) { metrics.channel <- metric