From bfb4f4676b4b280c7a5c230eb98351a869996996 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 14 Feb 2025 12:47:37 +0100 Subject: [PATCH 1/8] Add integration tests results to codecov --- .github/workflows/integration-tests-vm-type.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/integration-tests-vm-type.yml b/.github/workflows/integration-tests-vm-type.yml index ddf8101711..e0fd0ca157 100644 --- a/.github/workflows/integration-tests-vm-type.yml +++ b/.github/workflows/integration-tests-vm-type.yml @@ -106,6 +106,13 @@ jobs: with: paths: integration-tests/container-logs/**/integration-test-report-*.xml + - uses: codecov/test-results-action@v1 + if: ${{ !cancelled() }} + with: + directory: integration-tests/container-logs + token: ${{ secrets.CODECOV_TOKEN }} + flags: collector-integration-tests + - name: Create Benchmark VMs if: inputs.run-benchmarks run: | From 8851e591f7b39aadf399450a1f871f4b489233d9 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 14 Feb 2025 14:41:20 +0100 Subject: [PATCH 2/8] Add k8s integration tests to codecov --- .github/workflows/k8s-integration-tests.yml | 7 +++++++ ansible/k8s-integration-tests.yml | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index 739fd288c8..7fae9671f4 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -92,6 +92,13 @@ jobs: path: | ${{ github.workspace }}/integration-tests/container-logs/**/* + - uses: codecov/test-results-action@v1 + if: ${{ !cancelled() }} + with: + directory: integration-tests/container-logs + token: ${{ secrets.CODECOV_TOKEN }} + flags: collector-integration-tests + notify: runs-on: ubuntu-24.04 if: always() && contains(join(needs.*.result, ','), 'failure') && github.event_name != 'pull_request' diff --git a/ansible/k8s-integration-tests.yml b/ansible/k8s-integration-tests.yml index 878e5d999e..ab8abae6ff 100644 --- a/ansible/k8s-integration-tests.yml +++ b/ansible/k8s-integration-tests.yml @@ -190,6 +190,21 @@ tags: - test-only + - name: Write logs + ansible.builtin.copy: + content: "{{ log.log_lines }}" + dest: "{{ collector_root }}/integration-tests/integration-test-k8s.log" + mode: '644' + + - name: Report + community.general.make: + chdir: "{{ collector_root }}/integration-tests" + target: report + environment: + LOG_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s.log" + JUNIT_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s-report.xml" + delegate_to: localhost + - name: Cleanup namespace kubernetes.core.k8s: state: absent From 6cba0a7144ad6fdf4469117e6c292199f658c37a Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 14 Feb 2025 16:45:20 +0100 Subject: [PATCH 3/8] Fix report generation for k8s tests --- ansible/k8s-integration-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/k8s-integration-tests.yml b/ansible/k8s-integration-tests.yml index ab8abae6ff..0f67a49ee2 100644 --- a/ansible/k8s-integration-tests.yml +++ b/ansible/k8s-integration-tests.yml @@ -147,7 +147,7 @@ value: "{{ lookup('env', 'COLLECTOR_QA_TAG', default=lookup('file', collector_root + '/integration-tests/container/QA_TAG')) }}" - name: COLLECTOR_IMAGE value: "{{ collector_image }}" - args: ["-test.run", "^TestK8s.*"] + args: ["-test.run", "^TestK8s.*", "-test.v"] ports: - containerPort: 9999 volumeMounts: @@ -192,7 +192,7 @@ - name: Write logs ansible.builtin.copy: - content: "{{ log.log_lines }}" + content: "{{ log.log }}" dest: "{{ collector_root }}/integration-tests/integration-test-k8s.log" mode: '644' @@ -202,7 +202,7 @@ target: report environment: LOG_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s.log" - JUNIT_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s-report.xml" + JUNIT_FILE: "integration-test-k8s-report.xml" delegate_to: localhost - name: Cleanup namespace From fee09114c64c73c87d02152ff787db91122c8df8 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 14 Feb 2025 17:10:57 +0100 Subject: [PATCH 4/8] Add setup-go step --- .github/workflows/k8s-integration-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index 7fae9671f4..7662e29ca3 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -32,6 +32,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: integration-tests/go.mod + - uses: actions/setup-python@v5 with: python-version: "3.10" From c4cf1a38c3be19fbfd9e46f4a6cedc63ae07626c Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 14 Feb 2025 17:35:15 +0100 Subject: [PATCH 5/8] Fix directory --- .github/workflows/k8s-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index 7662e29ca3..c3f1ba4dc5 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -99,7 +99,7 @@ jobs: - uses: codecov/test-results-action@v1 if: ${{ !cancelled() }} with: - directory: integration-tests/container-logs + directory: integration-tests token: ${{ secrets.CODECOV_TOKEN }} flags: collector-integration-tests From fd4d4ad3415873d9b8be6badda9f1236d1ce0e68 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 17 Feb 2025 12:01:11 +0100 Subject: [PATCH 6/8] Add junit to report names This is needed for codecov to properly identify the test results. --- ansible/k8s-integration-tests.yml | 2 +- ansible/roles/run-test-target/tasks/test-collection-method.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/k8s-integration-tests.yml b/ansible/k8s-integration-tests.yml index 0f67a49ee2..0bfca18a4e 100644 --- a/ansible/k8s-integration-tests.yml +++ b/ansible/k8s-integration-tests.yml @@ -202,7 +202,7 @@ target: report environment: LOG_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s.log" - JUNIT_FILE: "integration-test-k8s-report.xml" + JUNIT_FILE: "integration-test-k8s-junit.xml" delegate_to: localhost - name: Cleanup namespace diff --git a/ansible/roles/run-test-target/tasks/test-collection-method.yml b/ansible/roles/run-test-target/tasks/test-collection-method.yml index 8ba37b508f..97dd5a0172 100644 --- a/ansible/roles/run-test-target/tasks/test-collection-method.yml +++ b/ansible/roles/run-test-target/tasks/test-collection-method.yml @@ -161,7 +161,7 @@ target: report environment: LOG_FILE: "{{ logs_root }}/integration-test-{{ vm_config }}.log" - JUNIT_FILE: "integration-test-report-{{ vm_config }}.xml" + JUNIT_FILE: "integration-test-report-{{ vm_config }}-junit.xml" delegate_to: localhost # If this host is just for a certain collection method, skip running From f241fbc2bf940c70d4aeca539d7feab7231b4320 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 17 Feb 2025 13:18:39 +0100 Subject: [PATCH 7/8] Test failure --- .github/workflows/k8s-integration-tests.yml | 1 + integration-tests/suites/k8s/namespace.go | 2 ++ integration-tests/suites/process_network.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index c3f1ba4dc5..cd7a968fb4 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -99,6 +99,7 @@ jobs: - uses: codecov/test-results-action@v1 if: ${{ !cancelled() }} with: + files: integration-test-k8s-junit.xml directory: integration-tests token: ${{ secrets.CODECOV_TOKEN }} flags: collector-integration-tests diff --git a/integration-tests/suites/k8s/namespace.go b/integration-tests/suites/k8s/namespace.go index 5b94df3a5e..591968c642 100644 --- a/integration-tests/suites/k8s/namespace.go +++ b/integration-tests/suites/k8s/namespace.go @@ -82,6 +82,8 @@ func (k *K8sNamespaceTestSuite) TestK8sNamespace() { namespace, ok := namespaceInterface.(string) k.Require().True(ok) k.Require().Equal(namespace, tt.expectecNamespace) + + k.Require().FailNow("Test failure") } } diff --git a/integration-tests/suites/process_network.go b/integration-tests/suites/process_network.go index 68d0669fcb..893fbd3f8f 100644 --- a/integration-tests/suites/process_network.go +++ b/integration-tests/suites/process_network.go @@ -115,6 +115,8 @@ func (s *ProcessNetworkTestSuite) TestProcessViz() { } s.Sensor().ExpectProcesses(s.T(), s.serverContainer, 10*time.Second, expectedProcesses...) + + s.Require().FailNow("Test failure") } func (s *ProcessNetworkTestSuite) TestProcessLineageInfo() { From 4725688e40781fe7aececa7a48c33679ed1dd6d1 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 17 Feb 2025 13:46:53 +0100 Subject: [PATCH 8/8] Try using .junit.xml suffix --- .github/workflows/integration-tests-vm-type.yml | 2 +- .github/workflows/k8s-integration-tests.yml | 3 ++- ansible/k8s-integration-tests.yml | 2 +- ansible/roles/run-test-target/tasks/test-collection-method.yml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests-vm-type.yml b/.github/workflows/integration-tests-vm-type.yml index e0fd0ca157..5c99a129f0 100644 --- a/.github/workflows/integration-tests-vm-type.yml +++ b/.github/workflows/integration-tests-vm-type.yml @@ -104,7 +104,7 @@ jobs: if: | failure() && !inputs.run-benchmarks with: - paths: integration-tests/container-logs/**/integration-test-report-*.xml + paths: integration-tests/container-logs/**/integration-test-report-*.junit.xml - uses: codecov/test-results-action@v1 if: ${{ !cancelled() }} diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index cd7a968fb4..29a2820160 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -99,8 +99,9 @@ jobs: - uses: codecov/test-results-action@v1 if: ${{ !cancelled() }} with: - files: integration-test-k8s-junit.xml + files: integration-test-k8s.junit.xml directory: integration-tests + disable_search: true token: ${{ secrets.CODECOV_TOKEN }} flags: collector-integration-tests diff --git a/ansible/k8s-integration-tests.yml b/ansible/k8s-integration-tests.yml index 0bfca18a4e..f59ef7fee7 100644 --- a/ansible/k8s-integration-tests.yml +++ b/ansible/k8s-integration-tests.yml @@ -202,7 +202,7 @@ target: report environment: LOG_FILE: "{{ collector_root }}/integration-tests/integration-test-k8s.log" - JUNIT_FILE: "integration-test-k8s-junit.xml" + JUNIT_FILE: "integration-test-k8s.junit.xml" delegate_to: localhost - name: Cleanup namespace diff --git a/ansible/roles/run-test-target/tasks/test-collection-method.yml b/ansible/roles/run-test-target/tasks/test-collection-method.yml index 97dd5a0172..7290f7bad7 100644 --- a/ansible/roles/run-test-target/tasks/test-collection-method.yml +++ b/ansible/roles/run-test-target/tasks/test-collection-method.yml @@ -161,7 +161,7 @@ target: report environment: LOG_FILE: "{{ logs_root }}/integration-test-{{ vm_config }}.log" - JUNIT_FILE: "integration-test-report-{{ vm_config }}-junit.xml" + JUNIT_FILE: "integration-test-report-{{ vm_config }}.junit.xml" delegate_to: localhost # If this host is just for a certain collection method, skip running