Skip to content

Commit 7808d2d

Browse files
tac0turtletac0turtlegithub-advanced-security[bot]
authored
ci: break out integration tests from unit (#2369)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview This pr splits the unit tests from integration in node. this allows the integration tests to have a custom job for integration test as the integration tests were flaky <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new commands to run integration tests and generate integration test coverage reports. - **Refactor** - Updated test and coverage commands for improved integration test handling and coverage reporting. - Adjusted test job workflow to separate unit and integration test coverage, with combined reporting. - **Chores** - Introduced build tags and linter directives to better organize test files and suppress unused code warnings. - Improved test isolation by using separate in-memory datastores during service restarts. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: tac0turtle <you@example.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent cacaec2 commit 7808d2d

9 files changed

Lines changed: 75 additions & 11 deletions

.github/workflows/test.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,34 @@ jobs:
7676
go-version-file: ./go.mod
7777
- name: Run unit test
7878
run: make test-cover
79-
- name: upload coverage report
80-
uses: codecov/codecov-action@v5.4.3
79+
- name: Upload unit test coverage report
80+
uses: actions/upload-artifact@v4
8181
with:
82-
token: ${{ secrets.CODECOV_TOKEN }}
83-
file: ./coverage.txt
82+
name: unit-test-coverage-report-${{ github.sha }}
83+
path: ./coverage.txt
84+
85+
integration_test:
86+
name: Run Integration Tests
87+
runs-on: ubuntu-latest
88+
permissions:
89+
contents: read
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: set up go
93+
uses: actions/setup-go@v5
94+
with:
95+
go-version-file: ./go.mod
96+
- name: Run integration test
97+
run: make test-integration-cover
98+
- name: Upload integration test coverage report
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: integration-test-coverage-report-${{ github.sha }}
102+
path: ./node/coverage.txt
84103

85104
e2e-tests:
86105
name: Run E2E System Tests
106+
needs: build_all-apps
87107
runs-on: ubuntu-latest
88108
steps:
89109
- uses: actions/checkout@v4
@@ -96,6 +116,7 @@ jobs:
96116

97117
evm-tests:
98118
name: Run EVM Execution Tests
119+
needs: build_all-apps
99120
runs-on: ubuntu-latest
100121
steps:
101122
- uses: actions/checkout@v4
@@ -105,3 +126,29 @@ jobs:
105126
go-version-file: ./go.mod
106127
- name: EVM Tests
107128
run: make test-evm
129+
130+
combine_and_upload_coverage:
131+
name: Combine and Upload Coverage
132+
needs: [unit_test, integration_test]
133+
runs-on: ubuntu-latest
134+
permissions:
135+
contents: read
136+
actions: read
137+
steps:
138+
- uses: actions/checkout@v4
139+
- name: Download unit test coverage report
140+
uses: actions/download-artifact@v4
141+
with:
142+
name: unit-test-coverage-report-${{ github.sha }}
143+
path: ./unit-coverage
144+
- name: Download integration test coverage report
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: integration-test-coverage-report-${{ github.sha }}
148+
path: ./integration-coverage
149+
- name: Upload combined coverage report
150+
uses: codecov/codecov-action@v5.4.3
151+
with:
152+
token: ${{ secrets.CODECOV_TOKEN }}
153+
files: ./unit-coverage/coverage.txt,./integration-coverage/coverage.txt
154+
flags: combined

node/execution_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build !integration
2+
13
package node
24

35
import (

node/full_node_integration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build integration
2+
13
package node
24

35
import (

node/full_node_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build !integration
2+
13
package node
24

35
import (

node/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:unused
12
package node
23

34
import (

node/helpers_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:unused
12
package node
23

34
import (

node/single_sequencer_integration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build integration
2+
13
package node
24

35
import (

node/single_sequencer_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build !integration
2+
13
package node
24

35
import (

scripts/test.mk

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ clean-testcache:
77
## test: Running unit tests for all go.mods
88
test:
99
@echo "--> Running unit tests"
10-
@go run -tags=run scripts/test.go
10+
@go run -tags='run integration' scripts/test.go
1111
.PHONY: test
1212

13+
## test-e2e: Running e2e tests
14+
test-integration:
15+
@echo "--> Running e2e tests"
16+
@cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' ./...
17+
.PHONY: test-integration
18+
1319
## test-e2e: Running e2e tests
1420
test-e2e: build build-da build-evm-single
1521
@echo "--> Running e2e tests"
1622
@cd test/e2e && go test -mod=readonly -failfast -timeout=15m -tags='e2e evm' ./... --binary=$(CURDIR)/build/testapp --evm-binary=$(CURDIR)/build/evm-single
1723
.PHONY: test-e2e
1824

19-
## cover: generate to code coverage report.
20-
cover:
21-
@echo "--> Generating Code Coverage"
22-
@go install github.com/ory/go-acc@latest
23-
@go-acc -o coverage.txt ./...
24-
.PHONY: cover
25+
## test-integration-cover: generate code coverage report for integration tests.
26+
test-integration-cover:
27+
@echo "--> Running integration tests with coverage"
28+
@cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' -coverprofile=coverage.txt -covermode=atomic ./...
29+
.PHONY: test-integration-cover
2530

2631
## test-cover: generate code coverage report.
2732
test-cover:

0 commit comments

Comments
 (0)