From d508ec24877a743c6d79dac0574c859e14d40218 Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Sun, 29 Jan 2017 14:47:07 -0500 Subject: Added oc_serviceaccount_secret to lib_openshift. --- .../test/integration/oc_serviceaccount_secret.yml | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 roles/lib_openshift/src/test/integration/oc_serviceaccount_secret.yml (limited to 'roles/lib_openshift/src/test/integration') 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'" -- cgit v1.2.3