From 7af3a5cc456c0cd72d35b75ef93210e423fee1eb Mon Sep 17 00:00:00 2001 From: rbroggi Date: Thu, 28 Oct 2021 19:55:22 +0200 Subject: [PATCH] Issue #1516 https://github.com/jaegertracing/jaeger/issues/1516 * introduction of build tags [grpc_plugin_storage_integration, badger_storage_integration] for better control over badgerstore_test.go and grpc_test.go which being fairly light-weight can be run along with the main make target `test` --- .github/workflows/ci-memory-badger.yml | 20 ------------------- Makefile | 14 +------------ examples/memstore-plugin/main.go | 2 ++ .../storage/integration/badgerstore_test.go | 6 ++---- plugin/storage/integration/grpc_test.go | 5 ++--- 5 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/ci-memory-badger.yml diff --git a/.github/workflows/ci-memory-badger.yml b/.github/workflows/ci-memory-badger.yml deleted file mode 100644 index e459b6edff7..00000000000 --- a/.github/workflows/ci-memory-badger.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: CIT Memory And Badger - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - memory-badger: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.5 - - - uses: actions/setup-go@v2 - with: - go-version: ^1.17 - - - name: Run in-memory and badger integration tests - run: make mem-and-badger-storage-integration-test diff --git a/Makefile b/Makefile index a801188b479..f6c82748369 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ clean: .PHONY: test test: go-gen - bash -c "set -e; set -o pipefail; $(GOTEST) ./... | $(COLORIZE)" + bash -c "set -e; set -o pipefail; $(GOTEST) -tags=badger_storage_integration,grpc_plugin_storage_integration ./... | $(COLORIZE)" .PHONY: all-in-one-integration-test all-in-one-integration-test: go-gen @@ -97,18 +97,6 @@ storage-integration-test: go-gen go clean -testcache bash -c "set -e; set -o pipefail; $(GOTEST) $(STORAGE_PKGS) | $(COLORIZE)" -.PHONY: mem-and-badger-storage-integration-test -mem-and-badger-storage-integration-test: badger-storage-integration-test grpc-plugin-storage-integration-test - -.PHONY: badger-storage-integration-test -badger-storage-integration-test: - STORAGE=badger $(MAKE) storage-integration-test - -.PHONY: grpc-plugin-storage-integration-test -grpc-plugin-storage-integration-test: - (cd examples/memstore-plugin/ && go build .) - STORAGE=grpc-plugin $(MAKE) storage-integration-test - .PHONY: index-cleaner-integration-test index-cleaner-integration-test: docker-images-elastic # Expire test results for storage integration tests since the environment might change diff --git a/examples/memstore-plugin/main.go b/examples/memstore-plugin/main.go index 03ea1db8abf..b741ece1cd3 100644 --- a/examples/memstore-plugin/main.go +++ b/examples/memstore-plugin/main.go @@ -11,6 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +//go:build grpc_plugin_storage_integration +// +build grpc_plugin_storage_integration package main diff --git a/plugin/storage/integration/badgerstore_test.go b/plugin/storage/integration/badgerstore_test.go index 6c2ee01affd..3aeb2b058dc 100644 --- a/plugin/storage/integration/badgerstore_test.go +++ b/plugin/storage/integration/badgerstore_test.go @@ -11,11 +11,12 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +//go:build badger_storage_integration +// +build badger_storage_integration package integration import ( - "os" "testing" assert "github.com/stretchr/testify/require" @@ -80,9 +81,6 @@ func (s *BadgerIntegrationStorage) refresh() error { } func TestBadgerStorage(t *testing.T) { - if os.Getenv("STORAGE") != "badger" { - t.Skip("Integration test against Badger skipped; set STORAGE env var to badger to run this") - } s := &BadgerIntegrationStorage{} assert.NoError(t, s.initialize()) s.IntegrationTestAll(t) diff --git a/plugin/storage/integration/grpc_test.go b/plugin/storage/integration/grpc_test.go index e9b1e2eb367..d202fa89281 100644 --- a/plugin/storage/integration/grpc_test.go +++ b/plugin/storage/integration/grpc_test.go @@ -12,6 +12,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +//go:build grpc_plugin_storage_integration +// +build grpc_plugin_storage_integration package integration @@ -86,9 +88,6 @@ func (s *GRPCStorageIntegrationTestSuite) cleanUp() error { } func TestGRPCStorage(t *testing.T) { - if os.Getenv("STORAGE") != "grpc-plugin" { - t.Skip("Integration test against grpc skipped; set STORAGE env var to grpc-plugin to run this") - } binaryPath := os.Getenv("PLUGIN_BINARY_PATH") if binaryPath == "" { t.Logf("PLUGIN_BINARY_PATH env var not set, using %s", defaultPluginBinaryPath)