feat(e2e-test): Add e2e-tests for zfs-localpv (#298)

Signed-off-by: w3aman <aman.gupta@mayadata.io>
This commit is contained in:
Aman Gupta 2021-06-09 21:21:39 +05:30 committed by GitHub
parent 53f872fcf1
commit 4e73638b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
137 changed files with 8745 additions and 0 deletions

23
e2e-tests/hack/crds.yaml Normal file
View file

@ -0,0 +1,23 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: e2eresults.e2e.io
spec:
# group name to use for REST API: /apis/<group>/<version>
group: e2e.io
# version name to use for REST API: /apis/<group>/<version>
version: v1alpha1
# either Namespaced or Cluster
scope: Cluster
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: e2eresults
# singular name to be used as an alias on the CLI and for display
singular: e2eresult
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: e2eResult
# shortNames allow shorter string to match your resource name on the CLI
shortNames:
- e2er

View file

@ -0,0 +1,11 @@
---
- block:
- name: Record test instance/run ID
set_fact:
run_id: "{{ lookup('env','RUN_ID') }}"
- name: Construct testname appended with runID
set_fact:
test_name: "{{ test_name }}-{{ run_id }}"
when: lookup('env','RUN_ID')

View file

@ -0,0 +1,10 @@
---
apiVersion: e2e.io/v1alpha1
kind: e2eResult
metadata:
# name of the e2e testcase
name: {{ test }}
spec:
testStatus:
phase: {{ phase }}
result: {{ verdict }}

38
e2e-tests/hack/rbac.yaml Normal file
View file

@ -0,0 +1,38 @@
apiVersion: v1
kind: Namespace
metadata:
name: e2e
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: e2e
namespace: e2e
labels:
name: e2e
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: e2e
labels:
name: e2e
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: e2e
labels:
name: e2e
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: e2e
subjects:
- kind: ServiceAccount
name: e2e
namespace: e2e

View file

@ -0,0 +1,45 @@
---
- block:
- name: Generate the e2e result CR to reflect SOT (Start of Test)
template:
src: e2e-result.j2
dest: e2e-result.yaml
vars:
test: "{{ test_name }}"
phase: in-progress
verdict: none
- name: Analyze the e2e cr yaml
shell: cat e2e-result.yaml
- name: Apply the e2e result CR
k8s:
state: present
src: e2e-result.yaml
register: e2er_status
failed_when: "e2er_status is failed"
when: status == "SOT"
- block:
- name: Generate the e2e result CR to reflect EOT (End of Test)
template:
src: e2e-result.j2
dest: e2e-result.yaml
vars:
test: "{{ test_name }}"
phase: completed
verdict: "{{ flag }}"
- name: Analyze the e2e cr yaml
shell: cat e2e-result.yaml
- name: Apply the e2e result CR
k8s:
state: present
src: e2e-result.yaml
merge_type: merge
register: e2er_status
failed_when: "e2er_status is failed"
when: status == "EOT"