Skip to content

Commit

Permalink
Add envvar switch to run integration tests
Browse files Browse the repository at this point in the history
Only run integration tests when ENDURO_PP_INTEGRATION_TEST is "true" to
avoid slow running (>1s) tests when they aren't necessary.
  • Loading branch information
djjuhasz committed Apr 24, 2024
1 parent 3d718e2 commit cc1b1bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ list-ignored-packages:

pre-commit: # @HELP Check that code is ready to commit.
pre-commit:
$(MAKE) -j \
ENDURO_PP_INTEGRATION_TEST=1 $(MAKE) -j \
golines \
gosec \
lint \
Expand Down Expand Up @@ -124,7 +124,7 @@ test: $(GOTESTSUM)

test-ci: # @HELP Run all tests in CI with coverage and the race detector.
test-ci:
$(MAKE) test GOTEST_FLAGS="-race -coverprofile=covreport -covermode=atomic"
ENDURO_PP_INTEGRATION_TEST=1 $(MAKE) test GOTEST_FLAGS="-race -coverprofile=covreport -covermode=atomic"

test-race: # @HELP Run all tests with the race detector.
test-race:
Expand Down
12 changes: 12 additions & 0 deletions internal/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package integration_test

import (
"context"
"os"
"path/filepath"
"slices"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -135,6 +138,15 @@ func (env *testEnv) copyTestTransfer(name string) {
}

func TestIntegration(t *testing.T) {
truthy := []string{"1", "t", "true"}
v := strings.ToLower(os.Getenv("ENDURO_PP_INTEGRATION_TEST"))
if !slices.Contains(truthy, v) {
t.Skipf(
"Set ENDURO_PP_INTEGRATION_TEST={%s} to run this test.",
strings.Join(truthy, ","),
)
}

ctx := context.Background()
temporalServer := setUpTemporal(ctx, t)

Expand Down

0 comments on commit cc1b1bb

Please sign in to comment.