From 3fa4a21edd0ebd1e412cffe72d9b499dc9fa2946 Mon Sep 17 00:00:00 2001 From: John Murret Date: Wed, 10 Jan 2024 20:39:34 -0700 Subject: [PATCH] remove the skipping of slow tests in go-tests-ce and go-test-enterprise (#20139) * remove the skipping of slow tests in go-tests-ce and go-test-enterprise * add license header --- .github/workflows/go-tests.yml | 2 -- agent/consul/operator_backend_test.go | 3 +++ lib/testhelpers/testhelpers.go | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lib/testhelpers/testhelpers.go diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index d1a0a5adf0..20c4544df2 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -270,7 +270,6 @@ jobs: runs-on: ${{ needs.setup.outputs.compute-large }} repository-name: ${{ github.repository }} go-tags: "" - go-test-flags: "${{ (github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')) && '-short' || '' }}" go-version: ${{ needs.get-go-version.outputs.go-version }} permissions: id-token: write # NOTE: this permission is explicitly required for Vault auth. @@ -293,7 +292,6 @@ jobs: runs-on: ${{ needs.setup.outputs.compute-large }} repository-name: ${{ github.repository }} go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consuldev' || '' }}" - go-test-flags: "${{ (github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')) && '-short' || '' }}" go-version: ${{ needs.get-go-version.outputs.go-version }} permissions: id-token: write # NOTE: this permission is explicitly required for Vault auth. diff --git a/agent/consul/operator_backend_test.go b/agent/consul/operator_backend_test.go index 0a4650359e..6127868b9f 100644 --- a/agent/consul/operator_backend_test.go +++ b/agent/consul/operator_backend_test.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/consul/acl" external "github.com/hashicorp/consul/agent/grpc-external" "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/lib/testhelpers" "github.com/hashicorp/consul/proto/private/pboperator" "github.com/hashicorp/consul/sdk/testutil/retry" "google.golang.org/grpc/credentials/insecure" @@ -25,6 +26,8 @@ import ( func TestOperatorBackend_TransferLeader(t *testing.T) { t.Parallel() + testhelpers.SkipFlake(t) + conf := testClusterConfig{ Datacenter: "dc1", Servers: 3, diff --git a/lib/testhelpers/testhelpers.go b/lib/testhelpers/testhelpers.go new file mode 100644 index 0000000000..0dfc07b549 --- /dev/null +++ b/lib/testhelpers/testhelpers.go @@ -0,0 +1,14 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package testhelpers + +import ( + "os" + "testing" +) + +func SkipFlake(t *testing.T) { + if os.Getenv("RUN_FLAKEY_TESTS") != "true" { + t.Skip("Skipped because marked as flake.") + } +}