Skip to content

Commit

Permalink
test: Try Saving Key (OT-CONTAINER-KIT#727)
Browse files Browse the repository at this point in the history
* try: saving a key

Signed-off-by: Shubham Gupta <[email protected]>

* sleep for 5 min

Signed-off-by: Shubham Gupta <[email protected]>

* fix

Signed-off-by: Shubham Gupta <[email protected]>

* host network

Signed-off-by: Shubham Gupta <[email protected]>

---------

Signed-off-by: Shubham Gupta <[email protected]>
Signed-off-by: Matt Robinson <[email protected]>
  • Loading branch information
shubham-cmyk authored and mattrobinsonsre committed Jul 11, 2024
1 parent 5ddf48f commit 87ff0ef
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,86 @@ spec:
timeout: 5m
content: |
sudo apt install redis-tools -y
- name: Ping Cluster
- name: Sleep for five minutes
try:
- sleep:
duration: 5m

- name: Ping Redis Cluster from every node
try:
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping
check:
($stdout=='PONG'): true

- name: Try saving a key
- name: Try saving a key from every node
try:
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-0 bar-0
check:
($stdout=='OK'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-1 bar-1
check:
($stdout=='OK'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-2 bar-2
check:
($stdout=='OK'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-3 bar-3
check:
($stdout=='OK'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-4 bar-4
check:
($stdout=='OK'): true
- script:
timeout: 30s
content: |
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo bar
kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-5 bar-5
check:
($stdout=='OK'): true
45 changes: 45 additions & 0 deletions tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,55 @@ spec:
file: ready-svc.yaml
- assert:
file: ready-pvc.yaml

- name: Ping Cluster
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

- name: Sleep for five minutes
try:
- sleep:
duration: 5m

- name: Try saving a key
try:
- script:
timeout: 30s
content: |
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 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 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 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 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 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 set foo-5 bar-5
check:
($stdout=='OK'): true

0 comments on commit 87ff0ef

Please sign in to comment.