Skip to content

Commit 0d085a6

Browse files
committed
Add live-cluster and offline mode CI lanes
Signed-off-by: Meina-rh <meinli@redhat.com>
1 parent f2d1827 commit 0d085a6

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

.github/workflows/e2e.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
name: E2E Test Suite
2020
runs-on: ubuntu-24.04
2121
timeout-minutes: 20
22+
strategy:
23+
matrix:
24+
include:
25+
- {mode: "live-cluster"}
26+
- {mode: "offline"}
27+
env:
28+
JOB_NAME: "${{ matrix.mode }}"
2229
steps:
2330
- name: Check out code into the Go module directory
2431
uses: actions/checkout@v4
@@ -55,13 +62,19 @@ jobs:
5562
run: make build
5663

5764
- name: Deploy KIND
65+
if: matrix.mode == 'live-cluster'
5866
run: make deploy-kind-ovnk
5967

6068
- name: Run E2E tests
61-
run: make run-e2e
69+
run: |
70+
if [ "${{ matrix.mode }}" == "live-cluster" ]; then
71+
make run-e2e MCP_MODE="live-cluster"
72+
else
73+
make run-e2e MCP_MODE="offline"
74+
fi
6275
6376
- name: Export kind logs
64-
if: always()
77+
if: always() && matrix.mode == 'live-cluster'
6578
run: |
6679
set -x
6780
# Only export logs if kind CLI exists and cluster is running
@@ -73,15 +86,15 @@ jobs:
7386
fi
7487
7588
- name: Upload kind logs
76-
if: always()
89+
if: always() && matrix.mode == 'live-cluster'
7790
uses: actions/upload-artifact@v4
7891
with:
7992
name: kind-logs-e2e-${{ github.run_id }}
8093
path: /tmp/kind/logs
8194
if-no-files-found: ignore
8295

8396
- name: Cleanup KIND cluster
84-
if: always()
97+
if: always() && matrix.mode == 'live-cluster'
8598
run: |
8699
set -x
87100
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

hack/run-e2e.sh

Lines changed: 9 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,11 @@ echo "Dependencies installed"
4041

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

test/e2e/e2e_suite_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
const (
3838
mcpServerPathEnvVar = "MCP_SERVER_PATH"
3939
kubeconfigEnvVar = "KUBECONFIG"
40+
mcpModeEnvVar = "MCP_MODE"
41+
mcpModeOffline = "offline"
4042
)
4143

4244
var (
@@ -90,6 +92,14 @@ func TestE2e(t *testing.T) {
9092
var _ = BeforeSuite(func() {
9193
mcpServerPath := os.Getenv(mcpServerPathEnvVar)
9294
Expect(mcpServerPath).NotTo(BeEmpty())
95+
96+
mcpMode := os.Getenv(mcpModeEnvVar)
97+
// Skip kubeconfig setup for offline mode tests
98+
// Offline tests (sosreport, must-gather) don't need a running cluster
99+
if mcpMode == mcpModeOffline {
100+
return
101+
}
102+
93103
kubeconfig := os.Getenv(kubeconfigEnvVar)
94104
Expect(kubeconfig).NotTo(BeEmpty())
95105

test/e2e/sosreport_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/ovn-kubernetes/ovn-kubernetes-mcp/test/e2e/utils"
1414
)
1515

16-
var _ = Describe("Sosreport Tools", func() {
16+
var _ = Describe("[offline] Sosreport Tools", func() {
1717
var sosreportInspector *inspector.MCPInspector
1818
var testdataSosreportPath string
1919

0 commit comments

Comments
 (0)