Skip to content

Commit 7753e60

Browse files
committed
USHIFT-6640: Update gateway api test
1 parent 1dee3d9 commit 7753e60

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

test/suites/optional/gateway-api.robot

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ Test Simple HTTP Route
2525
... Setup Namespace
2626
... Deploy Hello MicroShift
2727
Create Gateway ${GATEWAY_HOSTNAME} ${GATEWAY_PORT} ${NS_GATEWAY}
28-
Create HTTP Route ${GATEWAY_HOSTNAME} ${NS_GATEWAY}
29-
Wait Until Keyword Succeeds 20x 6s
30-
... Access Hello MicroShift Success ushift_port=${GATEWAY_PORT} hostname=${GATEWAY_HOSTNAME}
28+
${gateway_ip} Create HTTP Route ${GATEWAY_HOSTNAME} ${NS_GATEWAY}
29+
Wait Until Keyword Succeeds
30+
... 20x
31+
... 6s
32+
... Access Hello MicroShift Success
33+
... ushift_port=${GATEWAY_PORT}
34+
... hostname=${GATEWAY_HOSTNAME}
35+
... ushift_ip=${gateway_ip}
3136
[Teardown] Run Keywords
3237
... Delete Namespace
3338

@@ -65,6 +70,7 @@ Create Gateway
6570

6671
Create HTTP Route
6772
[Documentation] Create an HTTP route using the given hostname and namespace. Waits for acceptance in a gateway.
73+
... Returns the gateway service external IP.
6874
[Arguments] ${hostname} ${namespace}
6975
VAR ${tmp} /tmp/route.yaml
7076
VAR ${HOSTNAME} ${hostname} scope=TEST
@@ -73,13 +79,21 @@ Create HTTP Route
7379
... Remove File ${tmp}
7480
Generate File From Template ${HTTP_ROUTE_MANIFEST_TMPL} ${tmp}
7581
Oc Apply -n ${namespace} -f ${tmp}
82+
${gateway_ip} Wait For HTTPRoute And Gateway Ready ${namespace}
83+
RETURN ${gateway_ip}
7684

85+
Wait For HTTPRoute And Gateway Ready
86+
[Documentation] Wait for HTTPRoute acceptance and gateway readiness. Returns gateway service IP.
87+
[Arguments] ${namespace}
7788
Wait Until Keyword Succeeds 20x 6s
7889
... Verify HTTPRoute Parent Accepted ${namespace}
7990
Wait Until Keyword Succeeds 20x 6s
8091
... Verify HTTPRoute References Resolved ${namespace}
8192
Wait Until Keyword Succeeds 20x 6s
82-
... Verify Gateway Port Listening ${GATEWAY_PORT}
93+
... Verify Gateway Programmed ${namespace}
94+
${gateway_ip} Wait Until Keyword Succeeds 20x 6s
95+
... Verify Gateway Service Has External IP ${namespace}
96+
RETURN ${gateway_ip}
8397

8498
Verify HTTPRoute Parent Accepted
8599
[Documentation] Verify that the HTTPRoute is accepted by its parent gateway
@@ -99,11 +113,20 @@ Verify HTTPRoute References Resolved
99113
Should Not Contain ${result} False HTTPRoute references not resolved
100114
Should Not Contain ${result} Unknown HTTPRoute reference resolution status is unknown
101115

102-
Verify Gateway Port Listening
103-
[Documentation] Verify that the gateway port is accepting connections on the host.
104-
[Arguments] ${port}
105-
${rc}= Run And Return Rc nc -z -w 5 ${USHIFT_HOST} ${port}
106-
Should Be Equal As Integers ${rc} 0 Gateway port ${port} is not listening
116+
Verify Gateway Programmed
117+
[Documentation] Verify that the gateway data plane is programmed and ready to receive traffic
118+
[Arguments] ${namespace}
119+
${result} Run With Kubeconfig
120+
... oc get gateway/test-gateway -n ${namespace} -o jsonpath='{.status.conditions[?(@.type=="Programmed")].status}'
121+
Should Be Equal As Strings ${result} True Gateway is not yet programmed
122+
123+
Verify Gateway Service Has External IP
124+
[Documentation] Verify that the gateway's LoadBalancer service has an external IP assigned and return it
125+
[Arguments] ${namespace}
126+
${result} Run With Kubeconfig
127+
... oc get svc test-gateway-openshift-gateway-api -n ${namespace} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
128+
Should Not Be Empty ${result} Gateway service does not have an external IP assigned
129+
RETURN ${result}
107130

108131
Generate File From Template
109132
[Documentation] Generate file from template

0 commit comments

Comments
 (0)