Skip to content

Commit d4a2fc5

Browse files
jluhrsenMeina-rh
authored andcommitted
Add CI lane for e2e tests
Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
1 parent 8d6db36 commit d4a2fc5

File tree

3 files changed

+111
-2
lines changed

3 files changed

+111
-2
lines changed

.github/workflows/e2e.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: E2E Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: e2e-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
e2e:
19+
name: E2E Test Suite
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 20
22+
strategy:
23+
matrix:
24+
include:
25+
- {mode: "live-mode"}
26+
- {mode: "offline-mode"}
27+
env:
28+
JOB_NAME: "${{ matrix.mode }}"
29+
steps:
30+
- name: Check out code into the Go module directory
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version-file: go.mod
37+
cache: false
38+
id: go
39+
40+
- name: Install dependencies
41+
run: |
42+
set -x
43+
# Check if jinjanator is already available
44+
if ! command -v jinjanate &> /dev/null; then
45+
echo "jinjanator not found, installing..."
46+
sudo apt-get update
47+
sudo apt-get install -y pipx
48+
pipx install jinjanator
49+
pipx ensurepath
50+
echo "$HOME/.local/bin" >> $GITHUB_PATH
51+
else
52+
echo "jinjanator already installed"
53+
fi
54+
55+
- name: Verify jinjanator installation
56+
run: |
57+
set -x
58+
which jinjanate
59+
jinjanate --version
60+
61+
- name: Build
62+
run: make build
63+
64+
- name: Deploy KIND
65+
run: |
66+
if [ "${{ matrix.mode }}" == "live-mode" ]; then
67+
make deploy-kind-ovnk
68+
fi
69+
70+
- name: Run E2E tests
71+
run: |
72+
if [ "${{ matrix.mode }}" == "live-mode" ]; then
73+
make run-e2e MCP_MODE="Live Mode"
74+
else
75+
make run-e2e MCP_MODE="Offline Mode"
76+
fi
77+
78+
- name: Export kind logs
79+
if: always() && matrix.mode == 'live-mode'
80+
run: |
81+
set -x
82+
# Only export logs if kind CLI exists and cluster is running
83+
if command -v kind &> /dev/null && kind get clusters 2>/dev/null | grep -q '^ovn$'; then
84+
mkdir -p /tmp/kind/logs
85+
kind export logs --name ovn --verbosity 4 /tmp/kind/logs
86+
else
87+
echo "KIND cluster 'ovn' not found or kind CLI not available, skipping log export"
88+
fi
89+
90+
- name: Upload kind logs
91+
if: always() && matrix.mode == 'live-mode'
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: kind-logs-e2e-${{ github.run_id }}
95+
path: /tmp/kind/logs
96+
if-no-files-found: ignore
97+
98+
- name: Cleanup KIND cluster
99+
if: always() && matrix.mode == 'live-mode'
100+
run: |
101+
set -x
102+
kind delete cluster --name ovn || true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ NPM_VERSION := 11.6.1
4545

4646
.PHONY: run-e2e
4747
run-e2e:
48-
./hack/run-e2e.sh $(NVM_VERSION) $(NODE_VERSION) $(NPM_VERSION)
48+
./hack/run-e2e.sh $(NVM_VERSION) $(NODE_VERSION) $(NPM_VERSION) "$(MCP_MODE)"
4949

5050
.PHONY: test-e2e
5151
test-e2e: build deploy-kind-ovnk run-e2e undeploy-kind-ovnk

hack/run-e2e.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
NVM_VERSION=$1
66
NODE_VERSION=$2
77
NPM_VERSION=$3
8+
MCP_MODE=$4
89

910
if [[ -z "${NVM_VERSION}" ]] || [[ -z "${NODE_VERSION}" ]] || [[ -z "${NPM_VERSION}" ]]; then
1011
echo "NVM_VERSION, NODE_VERSION and NPM_VERSION are required"
@@ -40,4 +41,10 @@ echo "Dependencies installed"
4041

4142
# Run e2e tests
4243
echo "Running e2e tests"
43-
ginkgo -vv test/e2e
44+
if [[ "${MCP_MODE}" == "Offline Mode" ]]; then
45+
echo "Running offline mode tests (sosreport and must-gather)"
46+
ginkgo -vv --focus="Sosreport Tools" test/e2e
47+
else
48+
echo "Running online mode tests (excluding offline tests)"
49+
ginkgo -vv --skip="Sosreport Tools" test/e2e
50+
fi

0 commit comments

Comments
 (0)