diff --git a/.github/workflows/ci-grpc-badger.yml b/.github/workflows/ci-grpc-badger.yml new file mode 100644 index 00000000000..ace2692234f --- /dev/null +++ b/.github/workflows/ci-grpc-badger.yml @@ -0,0 +1,25 @@ +name: CIT gRPC And Badger + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + grpc-and-badger: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.5 + + - uses: actions/setup-go@v2 + with: + go-version: ^1.17 + + - name: Run Badger storage integration tests + run: make badger-storage-integration-test + + - name: Run gRPC storage integration tests + run: make grpc-storage-integration-test + +# TODO add code coverage reporting 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..9a22b7704fb 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=memory_storage_integration ./... | $(COLORIZE)" .PHONY: all-in-one-integration-test all-in-one-integration-test: go-gen @@ -97,17 +97,14 @@ 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 + bash -c "set -e; set -o pipefail; $(GOTEST) -tags=badger_storage_integration $(STORAGE_PKGS) | $(COLORIZE)" -.PHONY: grpc-plugin-storage-integration-test -grpc-plugin-storage-integration-test: +.PHONY: grpc-storage-integration-test +grpc-storage-integration-test: (cd examples/memstore-plugin/ && go build .) - STORAGE=grpc-plugin $(MAKE) storage-integration-test + bash -c "set -e; set -o pipefail; $(GOTEST) -tags=grpc_storage_integration $(STORAGE_PKGS) | $(COLORIZE)" .PHONY: index-cleaner-integration-test index-cleaner-integration-test: docker-images-elastic @@ -136,7 +133,7 @@ all-srcs: .PHONY: cover cover: nocover - $(GOTEST) -timeout 5m -coverprofile cover.out ./... + $(GOTEST) -tags=memory_storage_integration -timeout 5m -coverprofile cover.out ./... grep -E -v 'model.pb.*.go' cover.out > cover-nogen.out mv cover-nogen.out cover.out go tool cover -html=cover.out -o cover.html 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..2e16b6ec960 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_storage_integration +// +build grpc_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) diff --git a/plugin/storage/integration/memstore_test.go b/plugin/storage/integration/memstore_test.go index 4c497748821..1271d22173f 100644 --- a/plugin/storage/integration/memstore_test.go +++ b/plugin/storage/integration/memstore_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 memory_storage_integration +// +build memory_storage_integration package integration