From 5b14d94771021aaa108db4033789ca0192f79e3c Mon Sep 17 00:00:00 2001 From: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:36:41 +0530 Subject: [PATCH] Test (#659) Signed-off-by: Shubham Gupta --- .gitignore | 3 +- tests/_config/kuttl-test.yaml | 2 + .../setup/{ => redis-cluster}/00-install.yaml | 3 +- .../setup/{ => redis-cluster}/cluster.yaml | 0 .../ready-cluster-sts.yaml | 0 .../{ => redis-cluster}/ready-cluster.yaml | 2 +- .../setup/redis-cluster/ready-pvc.yaml | 181 ++++++++++++++++++ tests/readme.md | 12 +- 8 files changed, 198 insertions(+), 5 deletions(-) rename tests/e2e/v1beta2/setup/{ => redis-cluster}/00-install.yaml (69%) rename tests/e2e/v1beta2/setup/{ => redis-cluster}/cluster.yaml (100%) rename tests/e2e/v1beta2/setup/{ => redis-cluster}/ready-cluster-sts.yaml (100%) rename tests/e2e/v1beta2/setup/{ => redis-cluster}/ready-cluster.yaml (82%) create mode 100644 tests/e2e/v1beta2/setup/redis-cluster/ready-pvc.yaml diff --git a/.gitignore b/.gitignore index 3f4669bdb..d360ec637 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ testbin/* *~ .vscode -docs/build \ No newline at end of file +docs/build +kubeconfig \ No newline at end of file diff --git a/tests/_config/kuttl-test.yaml b/tests/_config/kuttl-test.yaml index ab9b63777..66a9a882e 100644 --- a/tests/_config/kuttl-test.yaml +++ b/tests/_config/kuttl-test.yaml @@ -4,5 +4,7 @@ startKIND: false kindConfig: "./kind-config.yaml" parallel: 1 timeout: 300 +testDirs: +- tests/e2e/v1beta2/setup suppress : - events \ No newline at end of file diff --git a/tests/e2e/v1beta2/setup/00-install.yaml b/tests/e2e/v1beta2/setup/redis-cluster/00-install.yaml similarity index 69% rename from tests/e2e/v1beta2/setup/00-install.yaml rename to tests/e2e/v1beta2/setup/redis-cluster/00-install.yaml index 94b166978..1aef14859 100644 --- a/tests/e2e/v1beta2/setup/00-install.yaml +++ b/tests/e2e/v1beta2/setup/redis-cluster/00-install.yaml @@ -4,4 +4,5 @@ apply : - cluster.yaml assert : - ready-cluster.yaml - - ready-cluster-sts.yaml \ No newline at end of file + - ready-cluster-sts.yaml + - ready-pvc.yaml \ No newline at end of file diff --git a/tests/e2e/v1beta2/setup/cluster.yaml b/tests/e2e/v1beta2/setup/redis-cluster/cluster.yaml similarity index 100% rename from tests/e2e/v1beta2/setup/cluster.yaml rename to tests/e2e/v1beta2/setup/redis-cluster/cluster.yaml diff --git a/tests/e2e/v1beta2/setup/ready-cluster-sts.yaml b/tests/e2e/v1beta2/setup/redis-cluster/ready-cluster-sts.yaml similarity index 100% rename from tests/e2e/v1beta2/setup/ready-cluster-sts.yaml rename to tests/e2e/v1beta2/setup/redis-cluster/ready-cluster-sts.yaml diff --git a/tests/e2e/v1beta2/setup/ready-cluster.yaml b/tests/e2e/v1beta2/setup/redis-cluster/ready-cluster.yaml similarity index 82% rename from tests/e2e/v1beta2/setup/ready-cluster.yaml rename to tests/e2e/v1beta2/setup/redis-cluster/ready-cluster.yaml index 54077ef06..49e754e81 100644 --- a/tests/e2e/v1beta2/setup/ready-cluster.yaml +++ b/tests/e2e/v1beta2/setup/redis-cluster/ready-cluster.yaml @@ -3,5 +3,5 @@ kind: RedisCluster metadata: name: redis-cluster-v1beta2 status: - # readyFollowerReplicas: 3 + readyFollowerReplicas: 3 readyLeaderReplicas: 3 diff --git a/tests/e2e/v1beta2/setup/redis-cluster/ready-pvc.yaml b/tests/e2e/v1beta2/setup/redis-cluster/ready-pvc.yaml new file mode 100644 index 000000000..a89bfa22a --- /dev/null +++ b/tests/e2e/v1beta2/setup/redis-cluster/ready-pvc.yaml @@ -0,0 +1,181 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-leader-0 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-leader-1 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-leader-2 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-follower-0 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-follower-1 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-conf-redis-cluster-v1beta2-follower-2 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-0 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-1 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-2 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-0 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-1 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-2 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + phase: Bound diff --git a/tests/readme.md b/tests/readme.md index 5538aa670..f4057b698 100644 --- a/tests/readme.md +++ b/tests/readme.md @@ -20,7 +20,7 @@ Ensure you have the following tools installed: Create a 3-node kind cluster using the provided configuration: ```bash -kind create cluster --config /redis-operator/tests/_config/kind-config.yaml +kind create cluster --config tests/_config/kind-config.yaml ``` ### 2. Install the Redis Operator @@ -35,6 +35,14 @@ Please refer to the repository's README for detailed instructions on installing Execute the kuttl test using the following command: +To run all default tests ( _config/kuttl-test.yaml is the default config file ) + +```bash +kubectl kuttl test --config tests/_config/kuttl-test.yaml +``` + +To run a test at specified path + ```bash -kubectl kuttl test redis-operator/tests/e2e/v1beta2 --config /redis-operator/tests/_config/kuttl-test.yaml --timeout 600 +kubectl kuttl test tests/e2e/v1beta2 --config tests/_config/kuttl-test.yaml --timeout 600 ```