From 27be26fb1b5da22b7c84dc9b2f34b0ab361c25dd Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 21:45:58 +0530 Subject: [PATCH 1/6] test: test for acl user Signed-off-by: Shubham Gupta --- .../acl-user/redis-cluster/acl-secret.yaml | 11 + .../acl-user/redis-cluster/chainsaw-test.yaml | 137 ++++++++++++ .../acl-user/redis-cluster/cluster.yaml | 50 +++++ .../acl-user/redis-cluster/ready-cluster.yaml | 7 + .../acl-user/redis-cluster/ready-pvc.yaml | 181 ++++++++++++++++ .../acl-user/redis-cluster/ready-sts.yaml | 25 +++ .../acl-user/redis-cluster/ready-svc.yaml | 201 ++++++++++++++++++ 7 files changed, 612 insertions(+) create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml create mode 100644 tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml new file mode 100644 index 000000000..675db6f1c --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: acl-secret +type: Opaque +stringData: + # yamllint disable-line rule:line-length + user.acl: | + user opstree on ~* &* +@all >abc@123 + user buildpiper on ~* &* +@all >abc@123 diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml new file mode 100644 index 000000000..b1a915d53 --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml @@ -0,0 +1,137 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json + +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + name: redis-cluster-setup +spec: + steps: + - try: + - apply: + file: acl-secret.yaml + - assert: + resource: + apiVersion: v1 + kind: Secret + metadata: + name: acl-secret + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + + - name: Ping Cluster Nodes + try: + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + + - name: Check Cluster Slots Coverage + try: + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + + - name: Try saving a key Without Password + try: + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-5 bar-5 + check: + ($stdout=='OK'): true \ No newline at end of file diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml new file mode 100644 index 000000000..6c231d87b --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml @@ -0,0 +1,50 @@ +apiVersion: redis.redis.opstreelabs.in/v1beta2 +kind: RedisCluster +metadata: + name: redis-cluster-v1beta2 +spec: + clusterSize: 3 + clusterVersion: v7 + persistenceEnabled: true + podSecurityContext: + runAsUser: 1000 + fsGroup: 1000 + kubernetesConfig: + image: quay.io/opstree/redis:latest + imagePullPolicy: Always + resources: + requests: + cpu: 101m + memory: 128Mi + limits: + cpu: 101m + memory: 128Mi + acl: + secret: + secretName: acl-secret + redisExporter: + enabled: true + image: quay.io/opstree/redis-exporter:v1.44.0 + imagePullPolicy: Always + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 100m + memory: 128Mi + storage: + volumeClaimTemplate: + spec: + # storageClassName: standard + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Gi + nodeConfVolume: true + nodeConfVolumeClaimTemplate: + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml new file mode 100644 index 000000000..49e754e81 --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml @@ -0,0 +1,7 @@ +apiVersion: redis.redis.opstreelabs.in/v1beta2 +kind: RedisCluster +metadata: + name: redis-cluster-v1beta2 +status: + readyFollowerReplicas: 3 + readyLeaderReplicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml new file mode 100644 index 000000000..a89bfa22a --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/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/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml new file mode 100644 index 000000000..1053eb784 --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: redis-cluster-v1beta2-leader + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader +status: + replicas: 3 + readyReplicas: 3 + +--- + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: redis-cluster-v1beta2-follower + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower +status: + replicas: 3 + readyReplicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml new file mode 100644 index 000000000..e8af234a6 --- /dev/null +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml @@ -0,0 +1,201 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + name: redis-cluster-v1beta2-leader-additional + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + name: redis-cluster-v1beta2-leader + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + - name: redis-exporter + port: 9121 + protocol: TCP + targetPort: 9121 + selector: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + name: redis-cluster-v1beta2-leader-headless + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + clusterIP: None + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: redis-cluster-v1beta2-leader + redis_setup_type: cluster + role: leader + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + name: redis-cluster-v1beta2-follower + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + - name: redis-exporter + port: 9121 + protocol: TCP + targetPort: 9121 + selector: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + name: redis-cluster-v1beta2-follower-additional + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/port: "9121" + prometheus.io/scrape: "true" + redis.opstreelabs.in: "true" + redis.opstreelabs.instance: redis-cluster-v1beta2 + labels: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + name: redis-cluster-v1beta2-follower-headless + ownerReferences: + - apiVersion: redis.redis.opstreelabs.in/v1beta2 + controller: true + kind: RedisCluster + name: redis-cluster-v1beta2 +spec: + clusterIP: None + ports: + - name: redis-client + port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: redis-cluster-v1beta2-follower + redis_setup_type: cluster + role: follower + type: ClusterIP +status: + loadBalancer: {} \ No newline at end of file From f834100db786b3a32a8bbb736947cf4636693f98 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 21:47:38 +0530 Subject: [PATCH 2/6] ci: add to ci Signed-off-by: Shubham Gupta --- .github/workflows/e2e-chainsaw.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-chainsaw.yml b/.github/workflows/e2e-chainsaw.yml index 653233432..946039c79 100644 --- a/.github/workflows/e2e-chainsaw.yml +++ b/.github/workflows/e2e-chainsaw.yml @@ -23,6 +23,7 @@ jobs: - ./tests/e2e-chainsaw/v1beta2/nodeport/ - ./tests/e2e-chainsaw/v1beta2/pvc-name/ - ./tests/e2e-chainsaw/v1beta2/keep-pvc/ + - ./tests/e2e-chainsaw/v1beta2/acl-user/ steps: - name: Checkout code @@ -38,7 +39,7 @@ jobs: - name: Check install run: chainsaw version - + - name: Install kubectl run: | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" @@ -55,7 +56,7 @@ jobs: cluster_name: kind - name: Load Docker image into Kind - run: | + run: | kubectl cluster-info --context kind-kind kind load docker-image redis-operator:e2e --name kind @@ -66,6 +67,6 @@ jobs: - name: Wait for Redis Operator to be ready run: | kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system - + - name: Run chainsaw test run: chainsaw test --test-dir ${{ matrix.testpath }} --config tests/_config/chainsaw-configuration.yaml From bd608ea17d91cbac0c2adf619399014dd9682f43 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 21:51:07 +0530 Subject: [PATCH 3/6] style: remove trailing space Signed-off-by: Shubham Gupta --- tests/_config/chainsaw-configuration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/_config/chainsaw-configuration.yaml b/tests/_config/chainsaw-configuration.yaml index 3e2daf4bb..2259297c9 100644 --- a/tests/_config/chainsaw-configuration.yaml +++ b/tests/_config/chainsaw-configuration.yaml @@ -3,8 +3,8 @@ apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Configuration metadata: - name: chainsaw-configuration -spec: + name: chainsaw-configuration +spec: delayBeforeCleanup: 10s timeouts: apply: 5m From f383d426bf2629123173583736254f9db5966957 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 22:28:13 +0530 Subject: [PATCH 4/6] test: fix uri scheme Signed-off-by: Shubham Gupta --- .github/workflows/e2e-chainsaw.yml | 16 ++++++++-------- .github/workflows/e2e.yaml | 14 +++++++------- .../acl-user/redis-cluster/chainsaw-test.yaml | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/e2e-chainsaw.yml b/.github/workflows/e2e-chainsaw.yml index 946039c79..a40c43f90 100644 --- a/.github/workflows/e2e-chainsaw.yml +++ b/.github/workflows/e2e-chainsaw.yml @@ -15,14 +15,14 @@ jobs: strategy: matrix: testpath: - - ./tests/e2e-chainsaw/v1beta2/teardown/ - - ./tests/e2e-chainsaw/v1beta2/setup/ - - ./tests/e2e-chainsaw/v1beta2/hostnetwork/ - - ./tests/e2e-chainsaw/v1beta2/password/ - - ./tests/e2e-chainsaw/v1beta2/ha-setup/ - - ./tests/e2e-chainsaw/v1beta2/nodeport/ - - ./tests/e2e-chainsaw/v1beta2/pvc-name/ - - ./tests/e2e-chainsaw/v1beta2/keep-pvc/ + # - ./tests/e2e-chainsaw/v1beta2/teardown/ + # - ./tests/e2e-chainsaw/v1beta2/setup/ + # - ./tests/e2e-chainsaw/v1beta2/hostnetwork/ + # - ./tests/e2e-chainsaw/v1beta2/password/ + # - ./tests/e2e-chainsaw/v1beta2/ha-setup/ + # - ./tests/e2e-chainsaw/v1beta2/nodeport/ + # - ./tests/e2e-chainsaw/v1beta2/pvc-name/ + # - ./tests/e2e-chainsaw/v1beta2/keep-pvc/ - ./tests/e2e-chainsaw/v1beta2/acl-user/ steps: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index c9c271f0a..c332f65d3 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -16,10 +16,10 @@ jobs: matrix: testpath: - ./tests/e2e/v1beta2/setup - - ./tests/e2e/v1beta2/teardown - - ./tests/e2e/v1beta2/ignore-annots - - ./tests/e2e/v1beta2/scaling - - ./tests/e2e/v1beta2/hostnetwork + # - ./tests/e2e/v1beta2/teardown + # - ./tests/e2e/v1beta2/ignore-annots + # - ./tests/e2e/v1beta2/scaling + # - ./tests/e2e/v1beta2/hostnetwork steps: - name: Checkout code @@ -32,7 +32,7 @@ jobs: run: | curl -L https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64 -o /usr/local/bin/kuttl chmod +x /usr/local/bin/kuttl - + - name: Install kubectl run: | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" @@ -46,7 +46,7 @@ jobs: cluster_name: kind - name: Load Docker image into Kind - run: | + run: | kubectl cluster-info --context kind-kind kind load docker-image redis-operator:e2e --name kind @@ -57,6 +57,6 @@ jobs: - name: Wait for Redis Operator to be ready run: | kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system - + - name: Run kuttl test run: kuttl test ${{ matrix.testpath }} --config tests/_config/kuttl-test.yaml diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml index b1a915d53..b99683a99 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml @@ -102,36 +102,36 @@ spec: - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-0 bar-0 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-0 bar-0 check: ($stdout=='OK'): true - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-1 bar-1 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-1 bar-1 check: ($stdout=='OK'): true - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-2 bar-2 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-2 bar-2 check: ($stdout=='OK'): true - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-3 bar-3 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-3 bar-3 check: ($stdout=='OK'): true - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-4 bar-4 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-4 bar-4 check: ($stdout=='OK'): true - script: timeout: 30s content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 -u opstree -a abc@123 set foo-5 bar-5 + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-5 bar-5 check: ($stdout=='OK'): true \ No newline at end of file From b3b9ae7db4fd730a88cecdc5cba205be86b173e3 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 22:50:12 +0530 Subject: [PATCH 5/6] ci: test on all Signed-off-by: Shubham Gupta --- .github/workflows/e2e-chainsaw.yml | 16 ++++++++-------- .github/workflows/e2e.yaml | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e-chainsaw.yml b/.github/workflows/e2e-chainsaw.yml index a40c43f90..946039c79 100644 --- a/.github/workflows/e2e-chainsaw.yml +++ b/.github/workflows/e2e-chainsaw.yml @@ -15,14 +15,14 @@ jobs: strategy: matrix: testpath: - # - ./tests/e2e-chainsaw/v1beta2/teardown/ - # - ./tests/e2e-chainsaw/v1beta2/setup/ - # - ./tests/e2e-chainsaw/v1beta2/hostnetwork/ - # - ./tests/e2e-chainsaw/v1beta2/password/ - # - ./tests/e2e-chainsaw/v1beta2/ha-setup/ - # - ./tests/e2e-chainsaw/v1beta2/nodeport/ - # - ./tests/e2e-chainsaw/v1beta2/pvc-name/ - # - ./tests/e2e-chainsaw/v1beta2/keep-pvc/ + - ./tests/e2e-chainsaw/v1beta2/teardown/ + - ./tests/e2e-chainsaw/v1beta2/setup/ + - ./tests/e2e-chainsaw/v1beta2/hostnetwork/ + - ./tests/e2e-chainsaw/v1beta2/password/ + - ./tests/e2e-chainsaw/v1beta2/ha-setup/ + - ./tests/e2e-chainsaw/v1beta2/nodeport/ + - ./tests/e2e-chainsaw/v1beta2/pvc-name/ + - ./tests/e2e-chainsaw/v1beta2/keep-pvc/ - ./tests/e2e-chainsaw/v1beta2/acl-user/ steps: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index c332f65d3..1d8fc2a6d 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -16,10 +16,10 @@ jobs: matrix: testpath: - ./tests/e2e/v1beta2/setup - # - ./tests/e2e/v1beta2/teardown - # - ./tests/e2e/v1beta2/ignore-annots - # - ./tests/e2e/v1beta2/scaling - # - ./tests/e2e/v1beta2/hostnetwork + - ./tests/e2e/v1beta2/teardown + - ./tests/e2e/v1beta2/ignore-annots + - ./tests/e2e/v1beta2/scaling + - ./tests/e2e/v1beta2/hostnetwork steps: - name: Checkout code From 94e50528462d5a8cb5dc95e4827ee049c72e30cc Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Mon, 4 Mar 2024 22:56:21 +0530 Subject: [PATCH 6/6] test: fix typo Signed-off-by: Shubham Gupta --- .../v1beta2/acl-user/redis-cluster/chainsaw-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml index b99683a99..46bf2141c 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml @@ -97,7 +97,7 @@ spec: check: ($stdout=='[OK] All 16384 slots covered.'): true - - name: Try saving a key Without Password + - name: Try saving a key With Password try: - script: timeout: 30s