mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 14:30:12 +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/apps/percona/deployers/percona.yml
Normal file
72
e2e-tests/apps/percona/deployers/percona.yml
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: percona
|
||||
labels:
|
||||
lkey: lvalue
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
lkey: lvalue
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
lkey: lvalue
|
||||
spec:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: 0.5
|
||||
name: percona
|
||||
image: openebs/tests-custom-percona:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- "--ignore-db-dir"
|
||||
- "lost+found"
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: k8sDem0
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: percona
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/mysql
|
||||
name: data-vol
|
||||
#<!-- BEGIN ANSIBLE MANAGED BLOCK -->
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: ["bash", "sql-test.sh"]
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 1
|
||||
timeoutSeconds: 10
|
||||
#<!-- END ANSIBLE MANAGED BLOCK -->
|
||||
volumes:
|
||||
- name: data-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: testclaim
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: testclaim
|
||||
spec:
|
||||
storageClassName: testclass
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: teststorage
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: percona-mysql
|
||||
labels:
|
||||
lkey: lvalue
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
selector:
|
||||
lkey: lvalue
|
||||
52
e2e-tests/apps/percona/deployers/run_e2e_test.yml
Normal file
52
e2e-tests/apps/percona/deployers/run_e2e_test.yml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
generateName: percona-deploy-
|
||||
namespace: e2e
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: percona-deploy
|
||||
labels:
|
||||
app: percona-deployment
|
||||
|
||||
spec:
|
||||
serviceAccountName: e2e
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: ansibletest
|
||||
image: openebs/zfs-localpv-e2e:ci
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
env:
|
||||
- name: ANSIBLE_STDOUT_CALLBACK
|
||||
value: default
|
||||
|
||||
# Name of the storage class to use for volume provisioning
|
||||
- name: STORAGE_CLASS
|
||||
value: 'zfspv-sc'
|
||||
|
||||
# This is the namespace where percona application will be deployed
|
||||
- name: APP_NAMESPACE
|
||||
value: 'percona'
|
||||
|
||||
# Application label for percona deployment in `key=value` format
|
||||
- name: APP_LABEL
|
||||
value: 'app=percona'
|
||||
|
||||
# Application PVC name
|
||||
- name: APP_PVC
|
||||
value: 'percona-pvc'
|
||||
|
||||
# Persistent volume storage capacity (for e.g, 5Gi)
|
||||
- name: PV_CAPACITY
|
||||
value: '5Gi'
|
||||
|
||||
# Use: `provision` to deploy the application
|
||||
# Use: `deprovision` to deprovision the application
|
||||
- name: ACTION
|
||||
value: 'provision'
|
||||
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", "ansible-playbook ./e2e-tests/apps/percona/deployers/test.yml -i /etc/ansible/hosts -v; exit 0"]
|
||||
57
e2e-tests/apps/percona/deployers/test.yml
Normal file
57
e2e-tests/apps/percona/deployers/test.yml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
gather_facts: False
|
||||
|
||||
vars_files:
|
||||
- test_vars.yml
|
||||
|
||||
tasks:
|
||||
- block:
|
||||
|
||||
## Generating the testname for deployment
|
||||
- include_tasks: /e2e-tests/hack/create_testname.yml
|
||||
|
||||
## RECORD START-OF-TEST IN e2e RESULT CR
|
||||
- include_tasks: "/e2e-tests/hack/update_e2e_result_resource.yml"
|
||||
vars:
|
||||
status: 'SOT'
|
||||
|
||||
- block:
|
||||
## Prerequisite tasks such as, namespace creation and replacing placeholder
|
||||
## with test specific values, before deploying application
|
||||
- include_tasks: /e2e-tests/utils/k8s/pre_create_app_deploy.yml
|
||||
vars:
|
||||
application: "{{ application_deployment }}"
|
||||
|
||||
## Deploying the application
|
||||
- include_tasks: /e2e-tests/utils/k8s/deploy_single_app.yml
|
||||
vars:
|
||||
application: "{{ application_deployment }}"
|
||||
|
||||
## Fetching the pod name
|
||||
- include_tasks: /e2e-tests/utils/k8s/fetch_app_pod.yml
|
||||
|
||||
## Checking the db is ready for connection
|
||||
- include_tasks: /e2e-tests/utils/applications/mysql/check_db_connection.yml
|
||||
|
||||
when: "'deprovision' not in action"
|
||||
|
||||
- name: Deprovisioning the Application
|
||||
include_tasks: /e2e-tests/utils/k8s/deprovision_deployment.yml
|
||||
vars:
|
||||
app_deployer: "{{ application_deployment }}"
|
||||
when: "'deprovision' is in action"
|
||||
|
||||
- set_fact:
|
||||
flag: "Pass"
|
||||
|
||||
rescue:
|
||||
- set_fact:
|
||||
flag: "Fail"
|
||||
|
||||
always:
|
||||
## RECORD END-OF-TEST IN e2e RESULT CR
|
||||
- include_tasks: /e2e-tests/hack/update_e2e_result_resource.yml
|
||||
vars:
|
||||
status: 'EOT'
|
||||
15
e2e-tests/apps/percona/deployers/test_vars.yml
Normal file
15
e2e-tests/apps/percona/deployers/test_vars.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
test_name: "percona-{{ action }}-{{ app_ns }}"
|
||||
|
||||
application_deployment: percona.yml
|
||||
|
||||
application_name: "percona"
|
||||
|
||||
storage_class: "{{ lookup('env','STORAGE_CLASS') }}"
|
||||
|
||||
app_ns: "{{ lookup('env','APP_NAMESPACE') }}"
|
||||
|
||||
app_label: "{{ lookup('env','APP_LABEL') }}"
|
||||
|
||||
app_pvc: "{{ lookup('env','APP_PVC') }}"
|
||||
|
||||
action: "{{ lookup('env','ACTION') }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue