summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/integration
diff options
context:
space:
mode:
authorThomas Wiest <twiest@redhat.com>2017-01-29 14:47:07 -0500
committerThomas Wiest <twiest@redhat.com>2017-02-06 17:03:48 -0500
commitd508ec24877a743c6d79dac0574c859e14d40218 (patch)
treeba462f616ca507e33cfbf4dc18e3764eb1aad4a1 /roles/lib_openshift/src/test/integration
parent76d0a4538baa3b59085d6dd57b92ffd145c76f93 (diff)
downloadopenshift-d508ec24877a743c6d79dac0574c859e14d40218.tar.gz
openshift-d508ec24877a743c6d79dac0574c859e14d40218.tar.bz2
openshift-d508ec24877a743c6d79dac0574c859e14d40218.tar.xz
openshift-d508ec24877a743c6d79dac0574c859e14d40218.zip
Added oc_serviceaccount_secret to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/test/integration')
-rwxr-xr-xroles/lib_openshift/src/test/integration/oc_serviceaccount_secret.yml79
1 files changed, 79 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/test/integration/oc_serviceaccount_secret.yml b/roles/lib_openshift/src/test/integration/oc_serviceaccount_secret.yml
new file mode 100755
index 000000000..d3bd9f3aa
--- /dev/null
+++ b/roles/lib_openshift/src/test/integration/oc_serviceaccount_secret.yml
@@ -0,0 +1,79 @@
+#!/usr/bin/ansible-playbook --module-path=../../../library/
+---
+- hosts: "{{ cli_master_test }}"
+ gather_facts: no
+ user: root
+
+ vars:
+ namespace: default
+ service_account_name: someserviceaccountname
+ secret_name: somesecretname
+
+ vars_prompt:
+ - name: cli_master_test
+ prompt: "Master to run against"
+ private: false
+ default: localhost
+
+ post_tasks:
+ - name: create service account to test with - Arrange
+ oc_serviceaccount:
+ namespace: "{{ namespace }}"
+ name: "{{ service_account_name }}"
+
+ - name: create secret to test with - Arrange
+ oc_secret:
+ namespace: "{{ namespace }}"
+ name: "{{ secret_name }}"
+ contents:
+ - path: blah
+ data: blahdeblah
+
+ - name: Ensure the service account and secret are not linked - Arrange
+ oc_serviceaccount_secret:
+ state: absent
+ service_account: "{{ service_account_name }}"
+ secret: "{{ secret_name }}"
+ namespace: "{{ namespace }}"
+
+ - name: get secrets of a service account - Act
+ oc_serviceaccount_secret:
+ state: list
+ service_account: builder
+ namespace: "{{ namespace }}"
+ register: sasecretout
+
+ - name: get secrets of a service account - Assert
+ assert:
+ that:
+ - "sasecretout.changed == False"
+ - "sasecretout.state == 'list'"
+ - "sasecretout.results | length > 0"
+
+ - name: Test linking a service account and secret - Act
+ oc_serviceaccount_secret:
+ service_account: "{{ service_account_name }}"
+ secret: "{{ secret_name }}"
+ namespace: "{{ namespace }}"
+ register: sasecretout
+
+ - name: Test linking a service account and secret - Assert
+ assert:
+ that:
+ - "sasecretout.changed == True"
+ - "sasecretout.state == 'present'"
+ - "sasecretout.results.returncode == 0"
+ - "sasecretout.results.results | length > 0"
+
+ - name: Test linking a service account and secret - idempotency - Act
+ oc_serviceaccount_secret:
+ service_account: "{{ service_account_name }}"
+ secret: "{{ secret_name }}"
+ namespace: "{{ namespace }}"
+ register: sasecretout
+
+ - name: Test linking a service account and secret - idempotency - Assert
+ assert:
+ that:
+ - "sasecretout.changed == False"
+ - "sasecretout.state == 'present'"