Skip to content

Commit

Permalink
Merge pull request #2377 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2375-to-release-4.14

[release-4.14] OCPBUGS-19518: Add ingress smoke test
  • Loading branch information
openshift-merge-robot authored Sep 22, 2023
2 parents 9ecf0dd + f2b750a commit 8a051e2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
18 changes: 18 additions & 0 deletions test/assets/hello-microshift-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-microshift
annotations:
haproxy.org/path-rewrite: /principal/(.*) /\1
spec:
rules:
- host: hello-microshift.cluster.local
http:
paths:
- path: /principal
pathType: Prefix
backend:
service:
name: hello-microshift
port:
number: 8080
9 changes: 7 additions & 2 deletions test/resources/microshift-network.resource
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Create Hello MicroShift Pod
Oc Create -f ${HELLO_USHIFT} -n ${NAMESPACE}
Oc Wait For pods -l app=hello-microshift condition\=Ready timeout=300s

Expose Hello MicroShift
[Documentation] Expose the "hello microshift" application via cluster ip service
Run With Kubeconfig oc expose pod hello-microshift -n ${NAMESPACE}

Expose Hello MicroShift Pod Via LB
[Documentation] Expose the "hello microshift" application through the load balancer
Run With Kubeconfig oc create service loadbalancer hello-microshift --tcp=${LB_PORT}:8080 -n ${NAMESPACE}
Expand All @@ -29,12 +33,13 @@ Expose Hello MicroShift Pod Via NodePort

Access Hello Microshift
[Documentation] Try to retrieve data from the "hello microshift" service end point
[Arguments] ${ushift_port} ${ushift_ip}=${USHIFT_HOST}
[Arguments] ${ushift_port} ${ushift_ip}=${USHIFT_HOST} ${path}=${EMPTY}

${connect_to}= Set Variable "hello-microshift.cluster.local:${HTTP_PORT}:${ushift_ip}:${ushift_port}"
${url_path}= Set Variable "http://hello-microshift.cluster.local${path}"

${result}= Run Process
... curl -i http://hello-microshift.cluster.local --connect-to ${connect_to}
... curl -i ${url_path} --connect-to ${connect_to}
... shell=True
... timeout=15s
Log Many ${result.rc} ${result.stdout} ${result.stderr}
Expand Down
26 changes: 26 additions & 0 deletions test/suites/standard/networking-smoke.robot
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Suite Teardown Teardown Suite With Namespace
Test Tags smoke


*** Variables ***
${HELLO_USHIFT_INGRESS} ./assets/hello-microshift-ingress.yaml


*** Test Cases ***
Router Smoke Test
[Documentation] Run a router smoke test
Expand All @@ -31,6 +35,20 @@ Load Balancer Smoke Test
[Documentation] Verify that Load Balancer correctly exposes HTTP service
Verify Hello MicroShift LB

Ingress Smoke Test
[Documentation] Verify a simple ingress rule correctly exposes HTTP service
[Setup] Run Keywords
... Create Hello MicroShift Pod
... Expose Hello MicroShift
... Create Hello MicroShift Ingress

Wait Until Keyword Succeeds 10x 6s
... Access Hello Microshift ${HTTP_PORT} path="/principal"

[Teardown] Run Keywords
... Delete Hello MicroShift Ingress
... Delete Hello MicroShift Pod And Service


*** Keywords ***
Expose Hello MicroShift Service Via Route
Expand All @@ -41,3 +59,11 @@ Expose Hello MicroShift Service Via Route
Delete Hello MicroShift Route
[Documentation] Delete route for cleanup.
Oc Delete route/hello-microshift -n ${NAMESPACE}

Create Hello MicroShift Ingress
[Documentation] Create ingress rule.
Oc Create -f ${HELLO_USHIFT_INGRESS} -n ${NAMESPACE}

Delete Hello MicroShift Ingress
[Documentation] Delete ingress for cleanup.
Oc Delete -f ${HELLO_USHIFT_INGRESS} -n ${NAMESPACE}

0 comments on commit 8a051e2

Please sign in to comment.