Skip to content

Commit af68542

Browse files
authored
ci: fix coverage of e2e tests not reported (#848)
By default "go test" only considers the coverage of code in the same package as the test. As our e2e tests are located in different packages to the actual resources, this always resulted in 0% coverage. I also added codecov flags to e2e & unit tests so we can differentiate between the coverage in codecov UI.
1 parent bfac734 commit af68542

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/test.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
- run: make test TESTARGS=-coverprofile=coverage.txt
1919

2020
- uses: codecov/codecov-action@v3
21+
with:
22+
flags: unit
2123

2224
integration:
2325
runs-on: ubuntu-latest
@@ -44,7 +46,7 @@ jobs:
4446

4547
- uses: hetznercloud/tps-action@main
4648

47-
- run: make testacc TESTARGS=-coverprofile=coverage.txt
49+
- run: make testacc TESTARGS="-coverprofile=coverage.txt -coverpkg=./..."
4850
env:
4951
# Domain must be available in the account running the tests. This domain is
5052
# available in the account running the public integration tests.
@@ -54,6 +56,8 @@ jobs:
5456
TF_LOG_PATH_MASK: test-%s.log
5557

5658
- uses: codecov/codecov-action@v3
59+
with:
60+
flags: e2e
5761

5862
- uses: actions/upload-artifact@v4
5963
if: always()

0 commit comments

Comments
 (0)