Skip to content

Commit

Permalink
restore old e2e make step and use 'go list' to filter unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: catsby <[email protected]>
  • Loading branch information
catsby committed Sep 19, 2024
1 parent 84288d1 commit 36c467e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ build-cli-mac-apple: ## Build the CLI for Mac Apple

.PHONY: test-unit
test-unit: ## Run unit tests
go test ./... -failfast -v -timeout 30m
go test -failfast -v -timeout 30m $$(go list ./... | grep -v '^github.com/defenseunicorns/maru-runner/src/test/e2e')


.PHONY: test-e2e
test-e2e: ## Run End to End (e2e) tests
cd src/test/e2e && TEST_E2E=1 go test ./... -failfast -v -timeout 30m
cd src/test/e2e && go test -failfast -v -timeout 30m

schema: ## Update JSON schema for maru tasks
./hack/generate-schema.sh
Expand Down
12 changes: 1 addition & 11 deletions src/test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const (
applianceModeEnvVar = "APPLIANCE_MODE"
applianceModeKeepEnvVar = "APPLIANCE_MODE_KEEP"
skipK8sEnvVar = "SKIP_K8S"
// environment variable to enable e2e tests
EnvE2E = "TEST_E2E"
)

// TestMain lets us customize the test run. See https://medium.com/goingogo/why-use-testmain-for-testing-in-go-dafb52b406bc.
Expand Down Expand Up @@ -62,7 +60,7 @@ func doAllTheThings(m *testing.M) (int, error) {
// `make build-cli`
_, err = os.Stat(e2e.MaruBinPath)
// only care about missing the maru binary if we're explicitly running the e2e tests
if err != nil && os.Getenv("EnvE2E") != "" {
if err != nil {
return 1, fmt.Errorf("maru binary %s not found", e2e.MaruBinPath)
}

Expand All @@ -71,11 +69,3 @@ func doAllTheThings(m *testing.M) (int, error) {

return returnCode, nil
}

func skipIfNotE2E(t *testing.T) {
t.Helper()
if os.Getenv(EnvE2E) == "" {
t.Skipf("End to End tests skipped unless env '%s' set", EnvE2E)
return
}
}
1 change: 0 additions & 1 deletion src/test/e2e/runner_inputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

func TestRunnerInputs(t *testing.T) {
skipIfNotE2E(t)
t.Run("test that default values for inputs work when not required", func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion src/test/e2e/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

func TestTaskRunner(t *testing.T) {
skipIfNotE2E(t)
t.Log("E2E: Task Maru")

t.Run("run action", func(t *testing.T) {
Expand Down

0 comments on commit 36c467e

Please sign in to comment.