summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/integration
diff options
context:
space:
mode:
authorThomas Wiest <twiest@redhat.com>2017-01-19 16:16:19 -0500
committerThomas Wiest <twiest@redhat.com>2017-01-25 13:52:41 -0500
commit8f06d5e59f4bfb138b55569431f665f21437ff6c (patch)
tree1c00a730e35936f34743ca54f89a4cc6e0cd3e06 /roles/lib_openshift/src/test/integration
parentd8fee0cc8441812cdd5e7aaae815adad7a9bbee7 (diff)
downloadopenshift-8f06d5e59f4bfb138b55569431f665f21437ff6c.tar.gz
openshift-8f06d5e59f4bfb138b55569431f665f21437ff6c.tar.bz2
openshift-8f06d5e59f4bfb138b55569431f665f21437ff6c.tar.xz
openshift-8f06d5e59f4bfb138b55569431f665f21437ff6c.zip
Added oc_secret to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/test/integration')
-rwxr-xr-xroles/lib_openshift/src/test/integration/oc_secret.yml125
1 files changed, 125 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/test/integration/oc_secret.yml b/roles/lib_openshift/src/test/integration/oc_secret.yml
new file mode 100755
index 000000000..e0456bd6e
--- /dev/null
+++ b/roles/lib_openshift/src/test/integration/oc_secret.yml
@@ -0,0 +1,125 @@
+#!/usr/bin/ansible-playbook --module-path=../../../library/
+
+---
+- hosts: "{{ cli_master_test }}"
+ gather_facts: no
+ user: root
+ vars_prompt:
+ - name: cli_master_test
+ prompt: "Master to run against"
+ private: false
+ default: localhost
+
+ vars:
+ secret_name: secret-int-test
+ ns_name: default
+ config_path: "/tmp/{{ secret_name }}--config.yml"
+ passwords_path: "/tmp/{{ secret_name }}--passwords.yml"
+
+ post_tasks:
+
+ - name: Setup our files to test with
+ copy:
+ dest: "{{ item.name }}"
+ content: "{{ item.content }}"
+ with_items:
+ - name: "{{ config_path }}"
+ content: |
+ value: True
+ - name: "{{ passwords_path }}"
+ content: |
+ test1
+ test2
+ test3
+ test4
+
+
+ - name: Make sure we're starting with a clean slate
+ oc_secret:
+ state: absent
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ register: secret_out
+
+ - name: Test adding a secret - Act
+ oc_secret:
+ state: present
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ files:
+ - name: config.yml
+ path: "{{ config_path }}"
+ - name: passwords.yml
+ path: "{{ passwords_path }}"
+ register: secret_out
+
+ - name: Test adding a secret - Assert
+ assert:
+ that:
+ - "secret_out.results.returncode == 0"
+ - "secret_out.changed == True"
+
+ - name: Test secret present idempotentcy - Act
+ oc_secret:
+ state: present
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ files:
+ - name: config.yml
+ path: "{{ config_path }}"
+ - name: passwords.yml
+ path: "{{ passwords_path }}"
+ register: secret_out
+
+ - name: Test secret present idempotentcy - Assert
+ assert:
+ that:
+ - "secret_out.changed == false"
+
+ - name: Test list secrets - Act
+ oc_secret:
+ state: list
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ register: secret_out
+
+ - name: Test list secrets - Assert
+ assert:
+ that:
+ - "secret_out.changed == false"
+ - "secret_out.results.exists == true"
+
+
+ - name: Test secret absent - Act
+ oc_secret:
+ state: absent
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ register: secret_out
+
+ - name: Test secret absent - Assert
+ assert:
+ that:
+ - "secret_out.changed == true"
+ - "secret_out.results.returncode == 0"
+
+ - name: Test secret absent idempotentcy - Act
+ oc_secret:
+ state: absent
+ namespace: "{{ ns_name }}"
+ name: "{{ secret_name }}"
+ register: secret_out
+
+ - name: Test secret idempotentcy - Assert
+ assert:
+ that:
+ - "secret_out.changed == false"
+
+
+ - name: Clean up the files we created
+ file:
+ state: absent
+ path: "{{ item }}"
+ with_items:
+ - "/tmp/{{ secret_name }}--config.yml"
+ - "/tmp/{{ secret_name }}--passwords.yml"