Skip to content

Commit 1fffce8

Browse files
committed
fix(dir): use correct values for e2e coverage
Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
1 parent 4a4215c commit 1fffce8

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

tests/Taskfile.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ tasks:
246246
aliases: [e2e:mcp]
247247
env:
248248
DIRECTORY_CLIENT_SERVER_ADDRESS: localhost:8888
249-
OASF_API_VALIDATION_SCHEMA_URL: "{{ .OASF_API_VALIDATION_SCHEMA_URL | default \"https://schema.oasf.outshift.com\" }}"
249+
OASF_API_VALIDATION_SCHEMA_URL: '{{ .OASF_API_VALIDATION_SCHEMA_URL | default "https://schema.oasf.outshift.com" }}'
250250
cmds:
251251
- defer: { task: server:stop }
252252
- task: server:start
@@ -500,17 +500,19 @@ tasks:
500500
aliases: [e2e:coverage]
501501
deps:
502502
- build:coverage
503-
vars:
504-
COVERAGE_DIR: '{{ .COVERAGE_DIR | default (print .ROOT_DIR "/.coverage/e2e") }}'
505503
cmds:
506-
- echo "Removing existing coverage directory and reports"
507-
- rm -rf {{.COVERAGE_DIR}}/*
508-
- echo "Creating new coverage directory"
509-
- mkdir -p {{.COVERAGE_DIR}}
504+
- cmd: |
505+
echo "Removing existing reports in {{.COVERAGE_DIR}}/e2e"
506+
rm -rf {{.COVERAGE_DIR}}/e2e/*
507+
if: "[ -d {{.COVERAGE_DIR}}/e2e ]"
508+
509+
- cmd: |
510+
echo "Creating new coverage directory: {{.COVERAGE_DIR}}/e2e"
511+
mkdir -p {{.COVERAGE_DIR}}/e2e
512+
if: "[ ! -d {{.COVERAGE_DIR}}/e2e ]"
513+
510514
- E2E_COVERAGE_ENABLED=true task test:e2e
511515
- task: test:e2e:coverage:process
512-
vars:
513-
COVERAGE_DIR: "{{ .COVERAGE_DIR }}"
514516

515517
test:e2e:coverage:extract-pods:
516518
desc: Extract coverage data from Kubernetes pods
@@ -519,7 +521,6 @@ tasks:
519521
E2E_COVERAGE_ENABLED: '{{ .E2E_COVERAGE_ENABLED | default "false" }}'
520522
NAMESPACE: '{{ .NAMESPACE | default "dir-server" }}'
521523
POD_SELECTORS: '{{ .POD_SELECTORS | default "app.kubernetes.io/name=apiserver app.kubernetes.io/name=reconciler" }}'
522-
COVERAGE_DIR: '{{ .COVERAGE_DIR | default (print .ROOT_DIR "/.coverage/e2e/pods") }}'
523524
cmds:
524525
- |
525526
if [ "{{.E2E_COVERAGE_ENABLED}}" = "true" ]; then
@@ -547,38 +548,37 @@ tasks:
547548
548549
# Extract coverage files (emptyDir persists across container restarts)
549550
echo "[coverage] Extracting coverage data from pod: $POD_NAME"
550-
mkdir -p {{.COVERAGE_DIR}}/pod-$POD_NAME
551-
{{.KUBECTL_BIN}} cp -n {{.NAMESPACE}} "$POD_NAME:/tmp/coverage" {{.COVERAGE_DIR}}/pod-$POD_NAME 2>&1 || echo "[coverage][warn] Failed to extract from $POD_NAME"
551+
mkdir -p {{.COVERAGE_DIR}}/e2e/pods/pod-$POD_NAME
552+
{{.KUBECTL_BIN}} cp -n {{.NAMESPACE}} "$POD_NAME:/tmp/coverage" {{.COVERAGE_DIR}}/e2e/pods/pod-$POD_NAME 2>&1 || echo "[coverage][warn] Failed to extract from $POD_NAME"
552553
done
553554
done
554555
555-
echo "[coverage] Coverage data extracted to {{.COVERAGE_DIR}}"
556+
echo "[coverage] Coverage data extracted to {{.COVERAGE_DIR}}/e2e/pods"
556557
else
557558
echo "[coverage] E2E_COVERAGE_ENABLED is false, skipping pod coverage extraction"
558559
fi
559560
560561
test:e2e:coverage:process:
561562
desc: Collect and merge E2E coverage data from pods
562-
vars:
563-
COVERAGE_DIR: '{{ .COVERAGE_DIR | default (print .ROOT_DIR "/.coverage/e2e") }}'
564563
cmds:
565564
- |
566565
echo "[e2e-coverage] Collecting and merging E2E coverage data from pods"
567-
if [ -d "{{.COVERAGE_DIR}}/pods" ]; then
566+
if [ -d "{{.COVERAGE_DIR}}/e2e/pods" ]; then
568567
# Build comma-separated list of pod directories
569-
pod_dirs=$(find {{.COVERAGE_DIR}}/pods -mindepth 1 -maxdepth 1 -type d 2>/dev/null | tr '\n' ',' | sed 's/,$//')
568+
pod_dirs=$(find {{.COVERAGE_DIR}}/e2e/pods -mindepth 1 -maxdepth 1 -type d 2>/dev/null | tr '\n' ',' | sed 's/,$//')
570569
571570
if [ -n "$pod_dirs" ]; then
572571
echo " Found pod coverage directories: $pod_dirs"
573572
574573
# server.out creation
575-
mkdir -p {{.COVERAGE_DIR}}/server-binary
576-
go tool covdata merge -i="$pod_dirs" -o={{.COVERAGE_DIR}}/server-binary
577-
go tool covdata textfmt -i={{.COVERAGE_DIR}}/server-binary -o={{.COVERAGE_DIR}}/server.out.tmp
574+
mkdir -p {{.COVERAGE_DIR}}/e2e/server-binary
575+
go tool covdata merge -i="$pod_dirs" -o={{.COVERAGE_DIR}}/e2e/server-binary
576+
go tool covdata textfmt -i={{.COVERAGE_DIR}}/e2e/server-binary -o={{.COVERAGE_DIR}}/e2e/server.out.tmp
577+
578578
# Filter out generated files (matching codecov.yml ignores)
579-
if [ -f {{.COVERAGE_DIR}}/server.out.tmp ]; then
580-
grep -v "\.pb\.go" {{.COVERAGE_DIR}}/server.out.tmp | grep -v "mock_.*\.go" > {{.COVERAGE_DIR}}/server.out || echo "mode: atomic" > {{.COVERAGE_DIR}}/server.out
581-
rm {{.COVERAGE_DIR}}/server.out.tmp
579+
if [ -f {{.COVERAGE_DIR}}/e2e/server.out.tmp ]; then
580+
grep -v "\.pb\.go" {{.COVERAGE_DIR}}/e2e/server.out.tmp | grep -v "mock_.*\.go" > {{.COVERAGE_DIR}}/e2e/server.out || echo "mode: atomic" > {{.COVERAGE_DIR}}/e2e/server.out
581+
rm {{.COVERAGE_DIR}}/e2e/server.out.tmp
582582
fi
583583
else
584584
echo "No pod coverage found"

0 commit comments

Comments
 (0)