summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/integration
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-26 14:16:23 -0500
committerGitHub <noreply@github.com>2017-01-26 14:16:23 -0500
commit8f2b3f132bc6cd03640c31c0c33cffb01f80138c (patch)
tree6ec0b8b4caed6279c45d14f2979390468b7772bc /roles/lib_openshift/src/test/integration
parenta44270f3dfd2c4707138891cfc485e0a82e7dd7c (diff)
parentb05c1e3bb7f1cd66a326bb7784ec166c4db4395a (diff)
downloadopenshift-8f2b3f132bc6cd03640c31c0c33cffb01f80138c.tar.gz
openshift-8f2b3f132bc6cd03640c31c0c33cffb01f80138c.tar.bz2
openshift-8f2b3f132bc6cd03640c31c0c33cffb01f80138c.tar.xz
openshift-8f2b3f132bc6cd03640c31c0c33cffb01f80138c.zip
Merge pull request #3183 from kwoodson/oc_scale
Adding oc_scale to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/test/integration')
-rwxr-xr-xroles/lib_openshift/src/test/integration/oc_scale.yml92
1 files changed, 92 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/test/integration/oc_scale.yml b/roles/lib_openshift/src/test/integration/oc_scale.yml
new file mode 100755
index 000000000..e96e16820
--- /dev/null
+++ b/roles/lib_openshift/src/test/integration/oc_scale.yml
@@ -0,0 +1,92 @@
+#!/usr/bin/ansible-playbook --module-path=../../../library/
+# ./oc_scale.yml -e "cli_master_test=$OPENSHIFT_MASTER
+---
+- hosts: "{{ cli_master_test }}"
+ gather_facts: no
+ user: root
+ tasks:
+ - name: list oc scale for default router dc
+ oc_scale:
+ state: list
+ name: router
+ namespace: default
+ kind: dc
+ register: scaleout
+ - debug: var=scaleout
+
+ - assert:
+ that:
+ - "'result' in scaleout"
+ - scaleout.result > 0
+ msg: "Did not find 'result' in returned value or result not > 0."
+
+ - name: get the rc for router
+ oc_obj:
+ state: list
+ kind: dc
+ namespace: default
+ selector: router=router
+ register: rcout
+ - debug:
+ msg: "{{ rcout.results.results[0]['items'][-1]['metadata']['name'] }}"
+
+ - name: scale dc to 1
+ oc_scale:
+ name: router
+ namespace: default
+ kind: dc
+ replicas: 1
+ register: scaleout
+ - debug: var=scaleout
+
+ # The preferred method here would be to let the module
+ # detect when its finished and time out
+ - name: let the scale happen
+ pause:
+ seconds: 10
+ when: scaleout.changed
+
+ - name: fetch the current router pods
+ oc_obj:
+ selector: router=router
+ namespace: default
+ kind: pod
+ state: list
+ register: pods
+ - debug: var=pods
+
+ - assert:
+ that:
+ - "'results' in pods and 'results' in pods.results"
+ - "{{ pods.results.results[0]['items']|length }} == 1"
+ msg: "Did not find 1 replica in scale results."
+
+ - name: scale dc to 2
+ oc_scale:
+ name: router
+ namespace: default
+ kind: dc
+ replicas: 2
+ register: scaleout
+ - debug: var=scaleout
+
+ # The preferred method here would be to let the module
+ # detect when its finished and time out
+ - name: let the scale happen
+ pause:
+ seconds: 30
+
+ - name: fetch the current router pods
+ oc_obj:
+ selector: router=router
+ namespace: default
+ kind: pod
+ state: list
+ register: pods
+ - debug: var=pods
+
+ - assert:
+ that:
+ - "'results' in pods and 'results' in pods.results"
+ - "{{ pods.results.results[0]['items']|length }} == 2"
+ msg: "Did not find 1 replica in scale results."