Skip to content

Commit 5aa2d74

Browse files
committed
fix(ci): align tests with gateway resource names
1 parent 865ebeb commit 5aa2d74

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

.github/workflows/conformance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
set +e
6969
go test -tags=conformance -count=1 -v -timeout 30m ./conformance/ \
7070
-args \
71-
-gateway-class nantian \
71+
-gateway-class nantian-gw \
7272
-report-output "$report_path" \
7373
-organization "Nantian Gateway" \
7474
-project "Nantian Gateway" \

scripts/ci/ci_assets_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,38 @@ func TestSmokeScriptForwardsToProgrammedGatewayListener(t *testing.T) {
131131
}
132132
}
133133

134+
func TestCIEntrypointsUseCurrentDeployResourceNames(t *testing.T) {
135+
conformanceWorkflow := string(readFile(t, repoPath(".github", "workflows", "conformance.yml")))
136+
if !strings.Contains(conformanceWorkflow, "-gateway-class nantian-gw") {
137+
t.Fatalf("conformance workflow does not use GatewayClass nantian-gw")
138+
}
139+
if strings.Contains(conformanceWorkflow, "-gateway-class nantian \\") {
140+
t.Fatalf("conformance workflow still uses old GatewayClass nantian")
141+
}
142+
143+
smokeScript := string(readFile(t, repoPath("test", "e2e", "smoke", "run.sh")))
144+
for _, want := range []string{
145+
`GATEWAY_CLASS_NAME="${GATEWAY_CLASS_NAME:-nantian-gw}"`,
146+
`CONTROL_PLANE_DEPLOYMENT="nantian-gw-controlplane"`,
147+
`DATA_PLANE_SELECTOR="app=nantian-gw-dataplane"`,
148+
`gatewayClassName: $GATEWAY_CLASS_NAME`,
149+
} {
150+
if !strings.Contains(smokeScript, want) {
151+
t.Fatalf("smoke script missing %q", want)
152+
}
153+
}
154+
155+
for _, oldName := range []string{
156+
"nantian-controlplane",
157+
"gatewayClassName: nantian",
158+
"app=nantian-dataplane",
159+
} {
160+
if strings.Contains(smokeScript, oldName) {
161+
t.Fatalf("smoke script still contains old resource name %q", oldName)
162+
}
163+
}
164+
}
165+
134166
func portKey(port int, protocol string) string {
135167
return fmt.Sprintf("%s/%d", protocol, port)
136168
}

test/e2e/smoke/run.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ GATEWAY_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
99
CLUSTER_NAME="${CLUSTER_NAME:-nantian-e2e}"
1010
CONTROL_PLANE_NS="nantian-gw"
1111
TEST_NS="nantian-e2e"
12-
DATA_PLANE_SVC="nantian-dataplane"
12+
CONTROL_PLANE_DEPLOYMENT="nantian-gw-controlplane"
13+
DATA_PLANE_SVC="nantian-gw-dataplane"
14+
DATA_PLANE_SELECTOR="app=nantian-gw-dataplane"
15+
GATEWAY_CLASS_NAME="${GATEWAY_CLASS_NAME:-nantian-gw}"
1316
ECHO_PORT=8080
1417
LOCAL_HTTP_PORT="${LOCAL_HTTP_PORT:-10080}"
1518
GATEWAY_HTTP_PORT="${GATEWAY_HTTP_PORT:-80}"
@@ -67,7 +70,7 @@ install_gateway_api_crds() {
6770

6871
# ── Step 3: deploy nantian-gw ──
6972
deploy_gateway() {
70-
if kubectl get deployment -n "$CONTROL_PLANE_NS" nantian-controlplane &>/dev/null; then
73+
if kubectl get deployment -n "$CONTROL_PLANE_NS" "$CONTROL_PLANE_DEPLOYMENT" &>/dev/null; then
7174
yellow "nantian-gw already deployed, skipping"
7275
return
7376
fi
@@ -130,7 +133,7 @@ kind: Gateway
130133
metadata:
131134
name: nantian-gw
132135
spec:
133-
gatewayClassName: nantian
136+
gatewayClassName: $GATEWAY_CLASS_NAME
134137
listeners:
135138
- name: http
136139
protocol: HTTP
@@ -195,7 +198,7 @@ YAML
195198
# ── Step 6: port-forward and send request ──
196199
send_request() {
197200
local dataplane_pod
198-
dataplane_pod=$(kubectl get pod -n "$CONTROL_PLANE_NS" -l app=nantian-dataplane -o jsonpath='{.items[0].metadata.name}')
201+
dataplane_pod=$(kubectl get pod -n "$CONTROL_PLANE_NS" -l "$DATA_PLANE_SELECTOR" -o jsonpath='{.items[0].metadata.name}')
199202
if [[ -z "$dataplane_pod" ]]; then
200203
fail "no data plane pod found"
201204
return 1

0 commit comments

Comments
 (0)