|
| 1 | +# Clear test cache |
| 2 | +[group('test')] |
| 3 | +clean-testcache: |
| 4 | + @echo "--> Clearing testcache" |
| 5 | + @go clean --testcache |
| 6 | + |
| 7 | +# Run unit tests for all go.mods |
| 8 | +[group('test')] |
| 9 | +test: |
| 10 | + @echo "--> Running unit tests" |
| 11 | + @go run -tags='run integration' scripts/test.go |
| 12 | + |
| 13 | +# Run all tests including Docker E2E |
| 14 | +[group('test')] |
| 15 | +test-all: test test-docker-e2e |
| 16 | + @echo "--> All tests completed" |
| 17 | + |
| 18 | +# Run integration tests |
| 19 | +[group('test')] |
| 20 | +test-integration: |
| 21 | + @echo "--> Running integration tests" |
| 22 | + @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' ./... |
| 23 | + |
| 24 | +# Run e2e tests |
| 25 | +[group('test')] |
| 26 | +test-e2e: build build-da build-evm docker-build-if-local |
| 27 | + @echo "--> Running e2e tests" |
| 28 | + @cd test/e2e && go test -mod=readonly -failfast -timeout=15m -tags='e2e evm' ./... --binary=../../build/testapp --evm-binary=../../build/evm |
| 29 | + |
| 30 | +# Run integration tests with coverage |
| 31 | +[group('test')] |
| 32 | +test-integration-cover: |
| 33 | + @echo "--> Running integration tests with coverage" |
| 34 | + @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' -coverprofile=coverage.txt -covermode=atomic ./... |
| 35 | + |
| 36 | +# Generate code coverage report |
| 37 | +[group('test')] |
| 38 | +test-cover: |
| 39 | + @echo "--> Running unit tests" |
| 40 | + @go run -tags=cover -race scripts/test_cover.go |
| 41 | + |
| 42 | +# Run micro-benchmarks for internal cache |
| 43 | +[group('test')] |
| 44 | +bench: |
| 45 | + @echo "--> Running internal cache benchmarks" |
| 46 | + @go test -bench=. -benchmem -run='^$' ./block/internal/cache |
| 47 | + |
| 48 | +# Run EVM tests |
| 49 | +[group('test')] |
| 50 | +test-evm: |
| 51 | + @echo "--> Running EVM tests" |
| 52 | + @cd execution/evm/test && go test -mod=readonly -failfast -timeout=15m ./... -tags=evm |
| 53 | + |
| 54 | +# Run Docker E2E tests |
| 55 | +[group('test')] |
| 56 | +test-docker-e2e: docker-build-if-local |
| 57 | + @echo "--> Running Docker E2E tests" |
| 58 | + @echo "--> Verifying Docker image exists locally..." |
| 59 | + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "ev-node" ]; then \ |
| 60 | + echo "--> Verifying Docker image exists locally..."; \ |
| 61 | + docker image inspect evstack:local-dev >/dev/null 2>&1 || (echo "ERROR: evstack:local-dev image not found. Run 'just docker-build' first." && exit 1); \ |
| 62 | + fi |
| 63 | + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e' -timeout=30m ./... |
| 64 | + @just docker-cleanup-if-local |
| 65 | + |
| 66 | +# Run Docker E2E Upgrade tests |
| 67 | +[group('test')] |
| 68 | +test-docker-upgrade-e2e: |
| 69 | + @echo "--> Running Docker Upgrade E2E tests" |
| 70 | + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMSingleUpgradeSuite$$/^TestEVMSingleUpgrade$$' ./... |
| 71 | + |
| 72 | +# Run Docker E2E cross-version compatibility tests |
| 73 | +[group('test')] |
| 74 | +test-docker-compat: |
| 75 | + @echo "--> Running Docker Sync Compatibility E2E tests" |
| 76 | + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMCompatSuite$$/^TestCrossVersionSync$$' ./... |
| 77 | + |
| 78 | +# Build Docker image if using local repository |
| 79 | +[group('test')] |
| 80 | +docker-build-if-local: |
| 81 | + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \ |
| 82 | + if docker image inspect evstack:local-dev >/dev/null 2>&1; then \ |
| 83 | + echo "--> Found local Docker image: evstack:local-dev (skipping build)"; \ |
| 84 | + else \ |
| 85 | + echo "--> Local repository detected, building Docker image..."; \ |
| 86 | + just docker-build; \ |
| 87 | + fi; \ |
| 88 | + else \ |
| 89 | + echo "--> Using remote repository: ${EV_NODE_IMAGE_REPO}"; \ |
| 90 | + fi |
| 91 | + |
| 92 | +# Clean up local Docker image if using local repository |
| 93 | +[group('test')] |
| 94 | +docker-cleanup-if-local: |
| 95 | + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \ |
| 96 | + echo "--> Untagging local Docker image (preserving layers for faster rebuilds)..."; \ |
| 97 | + docker rmi evstack:local-dev --no-prune 2>/dev/null || echo "Image evstack:local-dev not found or already removed"; \ |
| 98 | + else \ |
| 99 | + echo "--> Using remote repository, no cleanup needed"; \ |
| 100 | + fi |
0 commit comments