diff --git a/tests/data-assert/main.go b/tests/data-assert/main.go index a8d19055f..e7e942095 100644 --- a/tests/data-assert/main.go +++ b/tests/data-assert/main.go @@ -81,7 +81,7 @@ func genRedisDataCmd(cmd *cobra.Command, args []string) { }) case "sentinel": rdb = redis.NewFailoverClient(&redis.FailoverOptions{ - MasterName: "mymaster", + MasterName: "myMaster", SentinelAddrs: hosts, Password: pass, }) @@ -145,7 +145,7 @@ func checkRedisData() error { }) case "sentinel": rdb = redis.NewFailoverClient(&redis.FailoverOptions{ - MasterName: "mymaster", + MasterName: "myMaster", SentinelAddrs: hosts, Password: pass, }) diff --git a/tests/data-assert/resources.yaml b/tests/data-assert/resources.yaml index f7ed8a543..d69840959 100644 --- a/tests/data-assert/resources.yaml +++ b/tests/data-assert/resources.yaml @@ -88,7 +88,7 @@ data: }) case "sentinel": rdb = redis.NewFailoverClient(&redis.FailoverOptions{ - MasterName: "mymaster", + MasterName: "myMaster", SentinelAddrs: hosts, Password: pass, }) @@ -152,7 +152,7 @@ data: }) case "sentinel": rdb = redis.NewFailoverClient(&redis.FailoverOptions{ - MasterName: "mymaster", + MasterName: "myMaster", SentinelAddrs: hosts, Password: pass, }) diff --git a/tests/e2e-chainsaw/v1beta2/setup/ha/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/setup/ha/chainsaw-test.yaml index 2e4ee24e5..4f0f2420a 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/ha/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/ha/chainsaw-test.yaml @@ -15,6 +15,8 @@ spec: - try: - apply: file: ha.yaml + - apply: + file: ../../../../data-assert/resources.yaml - name: Test Master IP consistency try: @@ -31,6 +33,16 @@ spec: check: (contains($stdout, 'OK')): true + - name: Put data + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container data-assert data-assert -- + bash -c "cd /go/src/data-assert && go run main.go gen-redis-data --host redis-sentinel-sentinel.${NAMESPACE}.svc.cluster.local:26379 --mode sentinel" + check: + (contains($stdout, 'OK')): true + # New created cluster, the first pod is master - name: Terminate the redis-replication-0 pod try: @@ -53,3 +65,13 @@ spec: if [ "$MASTER_IP_FROM_SENTINEL" = "$MASTER_IP_FROM_LABEL" ] && [ "$MASTER_IP_FROM_SENTINEL" = "$MASTER_IP_FROM_STATUS" ]; then echo "OK"; else echo "FAIL"; fi check: (contains($stdout, 'OK')): true + + - name: Assert data + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container data-assert data-assert -- + bash -c "cd /go/src/data-assert && go run main.go chk-redis-data --host redis-sentinel-sentinel.${NAMESPACE}.svc.cluster.local:26379 --mode sentinel" + check: + (contains($stdout, 'OK')): true diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml index b084d7460..323bf477c 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml @@ -11,6 +11,8 @@ spec: file: cluster.yaml - apply: file: secret.yaml + - apply: + file: ../../../../data-assert/resources.yaml - assert: file: ready-cluster.yaml - assert: @@ -22,22 +24,15 @@ spec: - assert: file: secret.yaml - - name: Check Redis GET/SET + - name: Put data try: - script: timeout: 30s content: > - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- - redis-cli -c -p 6379 -a Opstree1234 set foo-0 bar-0 + kubectl exec --namespace ${NAMESPACE} --container data-assert data-assert -- + bash -c "cd /go/src/data-assert && go run main.go gen-redis-data --host redis-cluster-v1beta2-leader.${NAMESPACE}.svc.cluster.local:6379 --mode cluster --password Opstree1234" check: (contains($stdout, 'OK')): true - - script: - timeout: 30s - content: > - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- - redis-cli -c -p 6379 -a Opstree1234 get foo-0 - check: - (contains($stdout, 'bar-0')): true - name: Scale Out Redis Cluster try: @@ -64,6 +59,16 @@ spec: - assert: file: cluster-scale-out-status-03.yaml + - name: Assert data + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container data-assert data-assert -- + bash -c "cd /go/src/data-assert && go run main.go chk-redis-data --host redis-cluster-v1beta2-leader.${NAMESPACE}.svc.cluster.local:6379 --mode cluster --password Opstree1234" + check: + (contains($stdout, 'OK')): true + - name: Scale In Redis Cluster try: - apply: @@ -71,6 +76,16 @@ spec: - assert: file: ready-cluster.yaml + - name: Assert data + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container data-assert data-assert -- + bash -c "cd /go/src/data-assert && go run main.go chk-redis-data --host redis-cluster-v1beta2-leader.${NAMESPACE}.svc.cluster.local:6379 --mode cluster --password Opstree1234" + check: + (contains($stdout, 'OK')): true + - name: redis-cluster-uninstall try: - delete: