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 ```