summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-30 14:32:29 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-01-31 14:27:21 -0500
commit494f7e410df1641eb598e81f65153867071d5fee (patch)
treef8e836e4efd8426065211cf941ea48eadb38a2f4 /roles/lib_openshift
parent8237eebd0d24ed8577d8360bea220af70807d073 (diff)
downloadopenshift-494f7e410df1641eb598e81f65153867071d5fee.tar.gz
openshift-494f7e410df1641eb598e81f65153867071d5fee.tar.bz2
openshift-494f7e410df1641eb598e81f65153867071d5fee.tar.xz
openshift-494f7e410df1641eb598e81f65153867071d5fee.zip
Adding integration tests.
Diffstat (limited to 'roles/lib_openshift')
-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