Skip to content

Commit

Permalink
Split integration tests (#848)
Browse files Browse the repository at this point in the history
* Split integration tests

* fix makefile

* rename uploaded logs

* fix codecov token
  • Loading branch information
mariomac authored May 21, 2024
1 parent 8ff3b83 commit 8cc6694
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
run: make verify cov-exclude-generated
- name: Report coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./testoutput/cover.txt
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/pull_request_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
testoutput/kind
- name: Report coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./testoutput/itest-covdata.txt
flags: integration-test
token: ${{ secrets.CODECOV_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/pull_request_k8s_integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull request K8s integration tests

on:
push:
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main', 'release-*' ]

jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.22' ]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Clean up disk space
run: |
docker system prune -af
docker volume prune -f
- name: Run integration tests
run: make integration-test-k8s
timeout-minutes: 60
- name: Upload integration test logs
uses: actions/upload-artifact@v3
if: always()
with:
name: K8s test Logs
path: |
testoutput/*.log
testoutput/kind
- name: Report coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./testoutput/itest-covdata.txt
flags: k8s-integration-test
3 changes: 2 additions & 1 deletion .github/workflows/pull_request_oats_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
path: test/oats/*/build/*
- name: Report coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./testoutput/itest-covdata.txt
flags: oats-test
token: ${{ secrets.CODECOV_TOKEN }}
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,24 @@ run-integration-test:
go clean -testcache
go test -p 1 -failfast -v -timeout 60m -mod vendor -a ./test/integration/... --tags=integration

.PHONY: run-integration-test-k8s
run-integration-test-k8s:
@echo "### Running integration tests"
go clean -testcache
go test -p 1 -failfast -v -timeout 60m -mod vendor -a ./test/integration/... --tags=integration_k8s

.PHONY: integration-test
integration-test: prereqs prepare-integration-test
$(MAKE) run-integration-test || (ret=$$?; $(MAKE) cleanup-integration-test && exit $$ret)
$(MAKE) itest-coverage-data
$(MAKE) cleanup-integration-test

.PHONY: integration-test-k8s
integration-test-k8s: prereqs prepare-integration-test
$(MAKE) run-integration-test-k8s || (ret=$$?; $(MAKE) cleanup-integration-test && exit $$ret)
$(MAKE) itest-coverage-data
$(MAKE) cleanup-integration-test

.PHONY: itest-coverage-data
itest-coverage-data:
# merge coverage data from all the integration tests
Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/common/k8s_metrics_testfuncs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package k8s

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/daemonset/k8s_daemonset_main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/netolly/k8s_netolly_main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package promtest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package promtestsk

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/otel/k8s_main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/otel/k8s_otel_metrics_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/otel/k8s_otel_traces_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package otel

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/owners/k8s_daemonset_metadata_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package owners

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/owners/k8s_owners_main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

// package owners tests the selection and detection of pod ownership metadata, others than deployment:
// StatefulSet and DaemonSet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package owners

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/prom/k8s_prom_main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package prom

Expand Down
2 changes: 1 addition & 1 deletion test/integration/k8s/prom/k8s_prom_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build integration
//go:build integration_k8s

package prom

Expand Down

0 comments on commit 8cc6694

Please sign in to comment.