summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rwxr-xr-xroles/lib_openshift/src/test/integration/oc_service.yml154
1 files changed, 96 insertions, 58 deletions
diff --git a/roles/lib_openshift/src/test/integration/oc_service.yml b/roles/lib_openshift/src/test/integration/oc_service.yml
index 4222d32b2..a76fd746c 100755
--- a/roles/lib_openshift/src/test/integration/oc_service.yml
+++ b/roles/lib_openshift/src/test/integration/oc_service.yml
@@ -18,11 +18,55 @@
test-registtry: default
session_affinity: ClientIP
service_type: ClusterIP
- register: svcout
+ register: svc_out
+ - debug: var=svc_out
+
+ - assert:
+ that:
+ - "svc_out.results.results[0]['metadata']['name'] == 'test-registry'"
+ - svc_out.changed
+ msg: service create failed.
+
+ # Test idempotent create
+ - name: NOOP create the default registry service
+ oc_service:
+ namespace: default
+ name: test-registry
+ ports:
+ - name: 9000-tcp
+ port: 9000
+ protocol: TCP
+ targetPort: 9000
+ selector:
+ test-registtry: default
+ session_affinity: ClientIP
+ service_type: ClusterIP
+ register: svc_out
+
+ - assert:
+ that:
+ - "svc_out.results.results[0]['metadata']['name'] == 'test-registry'"
+ - svc_out.changed == False
+ msg: service create failed. No changes expected
+
+ - name: create the default registry service
+ oc_service:
+ namespace: default
+ name: test-registry
+ ports:
+ - name: 9000-tcp
+ port: 9000
+ protocol: TCP
+ targetPort: 9000
+ selector:
+ test-registtry: default
+ session_affinity: ClientIP
+ service_type: ClusterIP
+ register: svc_out
- assert:
- that: "svcout.results.results[0]['metadata']['name'] == 'test-registry'"
- msg: route create failed
+ that: "svc_out.results.results[0]['metadata']['name'] == 'test-registry'"
+ msg: service create failed
- name: oc_service
oc_service:
@@ -32,60 +76,54 @@
register: svc_out
- assert:
- that: "svcout.results.results[0]['metadata']['name'] == 'test-registry'"
- msg: route create failed
+ that: "svc_out.results.results[0]['metadata']['name'] == 'test-registry'"
+ msg: service create failed
+
+ - name: create the default registry service
+ oc_service:
+ namespace: default
+ name: test-registry
+ ports:
+ - name: 9001-tcp
+ port: 9001
+ protocol: TCP
+ targetPort: 9001
+ selector:
+ test-registtry: default
+ session_affinity: ClientIP
+ service_type: ClusterIP
+ register: svc_out
+ - assert:
+ that: "svc_out.results.results[0]['spec']['ports'][0]['name'] == '9001-tcp'"
+ msg: service update failed
+
+ - name: oc delete service
+ oc_service:
+ name: test-registry
+ namespace: default
+ state: absent
+ register: svc_out
+ - debug: var=svc_out
+
+ - assert:
+ that:
+ - "svc_out.results['returncode'] == 0"
+ - "svc_out.results.results == ''"
+ msg: service delete failed
+
+ - name: oc get service
+ oc_service:
+ name: test-registry
+ namespace: default
+ state: list
+ register: svc_out
+ - debug: var=svc_out
+
+ - assert:
+ that:
+ - svc_out.changed == False
+ - svc_out.results.returncode == 1
+ - "'not found' in svc_out.results.stderr"
+ msg: service get failed
-# - name: get route
-# oc_route:
-# state: list
-# name: test
-# namespace: default
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.results[0]['metadata']['name'] == 'test'"
-# msg: get route failed
-#
-# - name: delete route
-# oc_route:
-# state: absent
-# name: test
-# namespace: default
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.results.returncode == 0"
-# msg: delete route failed
-#
-# - name: create route
-# oc_route:
-# name: test
-# namespace: default
-# tls_termination: edge
-# cert_content: testing cert
-# cacert_content: testing cacert
-# key_content: testing key
-# service_name: test
-# host: test.example
-# register: routeout
-# - debug: var=routeout
-#
-# - name: create route noop
-# oc_route:
-# name: test
-# namespace: default
-# tls_termination: edge
-# cert_content: testing cert
-# cacert_content: testing cacert
-# key_content: testing key
-# service_name: test
-# host: test.example
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.changed == False"
-# msg: Route create not idempotent