Skip to content

Commit

Permalink
chore: use environment variable instead of build tags to control e2e (#…
Browse files Browse the repository at this point in the history
…3179)

(cherry picked from commit 46d0053)

# Conflicts:
#	Makefile
  • Loading branch information
p0mvn authored and mergify[bot] committed Oct 31, 2022
1 parent 7ac47d7 commit 9d71802
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ run-querygen:
###############################################################################

PACKAGES_UNIT=$(shell go list ./... | grep -E -v 'tests/simulator|e2e')
PACKAGES_E2E=$(shell go list -tags e2e ./... | grep '/e2e')
PACKAGES_E2E=$(shell go list ./... | grep '/e2e')
PACKAGES_SIM=$(shell go list ./... | grep '/tests/simulator')
TEST_PACKAGES=./...

Expand Down Expand Up @@ -261,25 +261,29 @@ test-sim-bench:
# In that case, run `make e2e-remove-resources`
# manually.
# Utilizes Go cache.
test-e2e: e2e-setup test-e2e-ci
test-e2e: OSMOSIS_E2E=True e2e-setup test-e2e-ci

# test-e2e-ci runs a full e2e test suite
# does not do any validation about the state of the Docker environment
# As a result, avoid using this locally.
test-e2e-ci:
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E)
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E)

# test-e2e-debug runs a full e2e test suite but does
# not attempt to delete Docker resources at the end.
test-e2e-debug: e2e-setup
<<<<<<< HEAD
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
=======
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
>>>>>>> 46d00535 (chore: use environment variable instead of build tags to control e2e (#3179))

# test-e2e-short runs the e2e test with only short tests.
# Does not delete any of the containers after running.
# Deletes any existing containers before running.
# Does not use Go cache.
test-e2e-short: e2e-setup
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_SKIP_UPGRADE=True OSMOSIS_E2E_SKIP_IBC=True OSMOSIS_E2E_SKIP_STATE_SYNC=True OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_SKIP_UPGRADE=True OSMOSIS_E2E_SKIP_IBC=True OSMOSIS_E2E_SKIP_STATE_SYNC=True OSMOSIS_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1

test-mutation:
@bash scripts/mutation-test.sh $(MODULES)
Expand Down
9 changes: 6 additions & 3 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package e2e

import (
Expand All @@ -15,6 +12,8 @@ import (
)

const (
// Environment variable signifying whether to run e2e tests.
e2eEnabledEnv = "OSMOSIS_E2E"
// Environment variable name to skip the upgrade tests
skipUpgradeEnv = "OSMOSIS_E2E_SKIP_UPGRADE"
// Environment variable name to skip the IBC tests
Expand All @@ -40,6 +39,10 @@ type IntegrationTestSuite struct {
}

func TestIntegrationTestSuite(t *testing.T) {
isEnabled := os.Getenv(e2eEnabledEnv)
if isEnabled != "True" {
t.Skip(fmt.Sprintf("e2e test is disabled. To run, set %s to True", e2eEnabledEnv))
}
suite.Run(t, new(IntegrationTestSuite))
}

Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package e2e

import (
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/initialization/init_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package initialization_test

import (
Expand Down

0 comments on commit 9d71802

Please sign in to comment.