Skip to content

Commit

Permalink
Added stage to test batch reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Chub committed Sep 10, 2024
1 parent 50c5e71 commit be73d8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
wait_for_pod_ready "sidecar-pythonscript"
wait_for_pod_ready "sidecar-pythonscript-logfile"
wait_for_pod_ready "sidecar-logtofile-pythonscript"
wait_for_pod_ready "sidecar-batch-reload"
wait_for_pod_ready "sidecar-req-once-per-batch"
wait_for_pod_ready "dummy-server-pod"
- name: Install Configmaps and Secrets
Expand All @@ -110,7 +110,7 @@ jobs:
sleep 20
echo "Installing resources..."
kubectl apply -f "test/resources/resources.yaml"
pods=("sidecar" "sidecar-basicauth-args" "sidecar-5xx" "sidecar-pythonscript" "sidecar-pythonscript-logfile" "sidecar-batch-reload")
pods=("sidecar" "sidecar-basicauth-args" "sidecar-5xx" "sidecar-pythonscript" "sidecar-pythonscript-logfile" "sidecar-req-once-per-batch")
resources=("sample-configmap" "sample-secret-binary" "absolute-configmap" "relative-configmap" "change-dir-configmap" "similar-configmap-secret" "url-configmap-500" "url-configmap-basic-auth" "sample-configmap")
for p in ${pods[*]}; do
for r in ${resources[*]}; do
Expand All @@ -129,9 +129,9 @@ jobs:
kubectl logs sidecar-pythonscript-logfile > /tmp/logs/sidecar-pythonscript-logfile.log
kubectl logs dummy-server-pod > /tmp/logs/dummy-server.log
# Sleep more to pass WATCH_SERVER_TIMEOUT seconds for batch-reload to occur
sleep 60
kubectl logs sidecar-batch-reload > /tmp/logs/sidecar-batch-reload.log
# Sleep more to pass WATCH_SERVER_TIMEOUT seconds for request once per batch to occur
sleep 40
kubectl logs sidecar-req-once-per-batch > /tmp/logs/sidecar-req-once-per-batch.log
- name: Upload artifacts (pod logs)
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -252,8 +252,7 @@ jobs:
kubectl exec sidecar -- sh -c "! test -e /tmp/orig-dir/change-dir.txt" && kubectl exec sidecar -- sh -c "test -e /tmp/new-dir/change-dir.txt" &&
kubectl exec sidecar -- sh -c "! test -e /tmp/similar-configmap.txt" && kubectl exec sidecar -- sh -c "test -e /tmp/change-similar-configmap.txt" &&
kubectl exec sidecar -- sh -c "! test -e /tmp/similar-secret.txt" && kubectl exec sidecar -- sh -c "test -e /tmp/change-similar-secret.txt"
# - name: Verify sidecar-batch-reload logs after initial sync
# run: |
# test $(cat /tmp/logs/sidecar-sidecar-batch-reload.log | grep "Hello from python script!" | wc -l) = "9" &&
# kubectl exec sidecar-logtofile-pythonscript -- sh -c "test -e /opt/logs/sidecar.log" &&
# test $(kubectl exec sidecar-logtofile-pythonscript -- sh -c 'cat /opt/logs/sidecar.log | grep "Hello from python script!" | wc -l') = "16"
- name: Verify sidecar-req-once-per-batch logs after initial sync
run: |
test $(cat /tmp/logs/sidecar-req-once-per-batch.log | grep "Request once per batch will be enabled" | wc -l) = "1" &&
test $(cat /tmp/logs/sidecar-req-once-per-batch.log | grep "Starting batch request" | wc -l) = "2"
2 changes: 1 addition & 1 deletion test/resources/sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ stringData:
apiVersion: v1
kind: Pod
metadata:
name: sidecar-batch-reload
name: sidecar-req-once-per-batch
namespace: default
spec:
serviceAccountName: sample-acc
Expand Down

0 comments on commit be73d8a

Please sign in to comment.