change order and validation of bootstrap and rest tasks as well as

volumes
pull/2931/head
Sascha Marcel Schmidt 2018-06-27 12:30:14 +02:00
parent b56f465145
commit 8e275ab2bd
No known key found for this signature in database
GPG Key ID: D1D6CE184437796D
3 changed files with 14 additions and 16 deletions

View File

@ -1,17 +1,19 @@
--- ---
- name: "Test REST endpoint."
uri: { url: "http://localhost:48080/hello", method: "GET", return_content: true }
register: "rest_hello_check"
ignore_errors: true
# Bootstrap heketi # Bootstrap heketi
- name: "Bootstrap heketi and start REST endpoint." - name: "Get state of heketi service, deployment and pods."
when: "rest_hello_check.content != \"Hello from Heketi\"" register: "initial_heketi_state"
include_tasks: "{{ item }}" changed_when: false
with_items: [ "setup/boot.yml", "setup/rest.yml" ] command: "kubectl get services,deployments,pods --selector=deploy-heketi --output=json"
- name: "Bootstrap heketi." - name: "Bootstrap heketi."
when: "rest_hello_check.content == \"Hello from Heketi\"" when:
- "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Service']\"))|length == 0"
- "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Deployment']\"))|length == 0"
- "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Pod']\"))|length == 0"
include_tasks: "setup/boot.yml" include_tasks: "setup/boot.yml"
- name: "Test rest endpoint port."
wait_for: { host: "localhost", port: "48080", state: "absent" }
- name: "Start REST endpoint."
include_tasks: "setup/rest.yml"
# Prepare heketi topology # Prepare heketi topology
- name: "Test heketi topology." - name: "Test heketi topology."

View File

@ -1,26 +1,22 @@
--- ---
# Enable local REST-Interface # Enable local REST-Interface
- name: "Get heketi initial pod state." - name: "Get heketi initial pod state."
tags: ["test"]
register: "initial_heketi_pod" register: "initial_heketi_pod"
command: "kubectl get pods --selector=deploy-heketi=pod,glusterfs=heketi-pod,name=deploy-heketi --output=json" command: "kubectl get pods --selector=deploy-heketi=pod,glusterfs=heketi-pod,name=deploy-heketi --output=json"
changed_when: false changed_when: false
- name: "Ensure heketi bootstrap pod is up." - name: "Ensure heketi bootstrap pod is up."
tags: ["test"]
assert: assert:
that: "(initial_heketi_pod.stdout|from_json|json_query('items[*]'))|length == 1" that: "(initial_heketi_pod.stdout|from_json|json_query('items[*]'))|length == 1"
- name: "Temporarily enable local port forwarding to heketi REST interface" - name: "Temporarily enable local port forwarding to heketi REST interface"
tags: ["test"]
vars: vars:
initial_heketi_pod_name: "{{ initial_heketi_pod.stdout|from_json|json_query(\"items[*].metadata.name|[0]\") }}" initial_heketi_pod_name: "{{ initial_heketi_pod.stdout|from_json|json_query(\"items[*].metadata.name|[0]\") }}"
command: "kubectl port-forward {{ initial_heketi_pod_name }} 48080:8080" command: "kubectl port-forward {{ initial_heketi_pod_name }} 48080:8080"
async: 180 async: 600
poll: 0 poll: 0
ignore_errors: "yes" ignore_errors: "yes"
register: "heketi_port_forwarding" register: "heketi_port_forwarding"
changed_when: false changed_when: false
- name: "Ensure port forwarding is enabled." - name: "Ensure port forwarding is enabled."
tags: ["test"]
retries: 10 retries: 10
delay: 5 delay: 5
assert: assert:
@ -30,7 +26,6 @@
- "heketi_port_forwarding.failed == false" - "heketi_port_forwarding.failed == false"
msg: "Port forwarding does not work." msg: "Port forwarding does not work."
- name: "Test REST endpoint." - name: "Test REST endpoint."
tags: ["test"]
uri: { url: "http://localhost:48080/hello", method: "GET", return_content: true } uri: { url: "http://localhost:48080/hello", method: "GET", return_content: true }
register: "rest_hello_check" register: "rest_hello_check"
until: "rest_hello_check.content == \"Hello from Heketi\"" until: "rest_hello_check.content == \"Hello from Heketi\""

View File

@ -17,6 +17,7 @@
when: "volume.name == 'heketidbstorage'" when: "volume.name == 'heketidbstorage'"
- name: "Provision database volume." - name: "Provision database volume."
command: "heketi-cli -s http://localhost:48080 setup-openshift-heketi-storage" command: "heketi-cli -s http://localhost:48080 setup-openshift-heketi-storage"
args: { chdir: "{{ artifacts_dir }}", creates: "{{ artifacts_dir }}/{{ heketi-storage.json }}" }
when: "heketi_database_volume_exists is undefined" when: "heketi_database_volume_exists is undefined"
- name: "Get heketi volume ids." - name: "Get heketi volume ids."
command: "heketi-cli -s http://localhost:48080 volume list --json" command: "heketi-cli -s http://localhost:48080 volume list --json"