Skip to content

Commit 28a3797

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 28a3797

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

tests/Taskfile.yml

Lines changed: 20 additions & 19 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
@@ -559,26 +561,25 @@ tasks:
559561
560562
test:e2e:coverage:process:
561563
desc: Collect and merge E2E coverage data from pods
562-
vars:
563-
COVERAGE_DIR: '{{ .COVERAGE_DIR | default (print .ROOT_DIR "/.coverage/e2e") }}'
564564
cmds:
565565
- |
566566
echo "[e2e-coverage] Collecting and merging E2E coverage data from pods"
567-
if [ -d "{{.COVERAGE_DIR}}/pods" ]; then
567+
if [ -d "{{.COVERAGE_DIR}}/e2e/pods" ]; then
568568
# 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/,$//')
569+
pod_dirs=$(find {{.COVERAGE_DIR}}/e2e/pods -mindepth 1 -maxdepth 1 -type d 2>/dev/null | tr '\n' ',' | sed 's/,$//')
570570
571571
if [ -n "$pod_dirs" ]; then
572572
echo " Found pod coverage directories: $pod_dirs"
573573
574574
# 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
575+
mkdir -p {{.COVERAGE_DIR}}/e2e/server-binary
576+
go tool covdata merge -i="$pod_dirs" -o={{.COVERAGE_DIR}}/e2e/server-binary
577+
go tool covdata textfmt -i={{.COVERAGE_DIR}}/e2e/server-binary -o={{.COVERAGE_DIR}}/e2e/server.out.tmp
578+
578579
# 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
580+
if [ -f {{.COVERAGE_DIR}}/e2e/server.out.tmp ]; then
581+
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
582+
rm {{.COVERAGE_DIR}}/e2e/server.out.tmp
582583
fi
583584
else
584585
echo "No pod coverage found"

0 commit comments

Comments
 (0)