mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
feat(e2e-test): Add e2e-tests for zfs-localpv (#298)
Signed-off-by: w3aman <aman.gupta@mayadata.io>
This commit is contained in:
parent
53f872fcf1
commit
4e73638b5a
137 changed files with 8745 additions and 0 deletions
72
e2e-tests/utils/k8s/deprovision_statefulset.yml
Normal file
72
e2e-tests/utils/k8s/deprovision_statefulset.yml
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
- block:
|
||||
|
||||
- name: Check if the statefulset application exists.
|
||||
shell: kubectl get pods -n {{ app_ns }} -l {{ app_label }}
|
||||
register: pods
|
||||
failed_when: "'No resources found' in pods.stdout"
|
||||
|
||||
- name: Obtaining PVCs related to the application.
|
||||
shell: kubectl get pvc -n {{ app_ns }} -l {{ app_label }} --no-headers -o custom-columns=:.metadata.name
|
||||
register: pvc_list
|
||||
|
||||
- name: Obtaining the PV names.
|
||||
shell: kubectl get pvc -l {{ app_label }} -n {{ app_ns }} --no-headers -o custom-columns=:.spec.volumeName
|
||||
register: pv_list
|
||||
|
||||
## Replacing the item names in the respective deployer spec file.
|
||||
- name: Replace the PVC name in application deployer spec.
|
||||
replace:
|
||||
path: "{{ app_deployer }}"
|
||||
regexp: "testclaim"
|
||||
replace: "{{ lookup('env','APP_PVC') }}"
|
||||
when: app_pvc is defined
|
||||
|
||||
- name: Replace the storageclass placeholder with provider
|
||||
replace:
|
||||
path: "{{ app_deployer }}"
|
||||
regexp: "testclass"
|
||||
replace: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}"
|
||||
when: storage_class is defined
|
||||
|
||||
- block:
|
||||
|
||||
- name: Get the application label values from env
|
||||
set_fact:
|
||||
app_lkey: "{{ app_label.split('=')[0] }}"
|
||||
app_lvalue: "{{ app_label.split('=')[1] }}"
|
||||
|
||||
- name: Replace the application label placeholder
|
||||
replace:
|
||||
path: "{{ app_deployer }}"
|
||||
regexp: "lkey: lvalue"
|
||||
replace: "{{ app_lkey }}: {{ app_lvalue }}"
|
||||
|
||||
when: app_label is defined
|
||||
|
||||
- name: Delete the application and its related service.
|
||||
shell: kubectl delete -f {{ app_deployer }} -n {{ app_ns }}
|
||||
register: app_status
|
||||
until: 'app_status.rc == 0'
|
||||
delay: 5
|
||||
retries: 60
|
||||
|
||||
- name: Deleting the PVC
|
||||
shell: kubectl delete pvc {{ item }} -n {{ app_ns }}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
with_items:
|
||||
- "{{ pvc_list.stdout_lines }}"
|
||||
|
||||
- name: Check if the PVCs are deleted
|
||||
shell: kubectl get pvc -n {{ app_ns }}
|
||||
register: list_pvc
|
||||
until: "'No resources found' in list_pvc.stderr"
|
||||
delay: 30
|
||||
retries: 15
|
||||
|
||||
- name: Delete the namespace.
|
||||
shell: kubectl delete ns {{ app_ns }}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue