From be73d8afedcbeda03ee619a030d0374c8dc76e7f Mon Sep 17 00:00:00 2001 From: Anton Chub Date: Tue, 10 Sep 2024 14:40:50 +0200 Subject: [PATCH] Added stage to test batch reload --- .github/workflows/build_and_test.yaml | 19 +++++++++---------- test/resources/sidecar.yaml | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 8b6f6da3..e13f521b 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -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 @@ -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 @@ -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: @@ -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" diff --git a/test/resources/sidecar.yaml b/test/resources/sidecar.yaml index fea448bd..5104d57a 100644 --- a/test/resources/sidecar.yaml +++ b/test/resources/sidecar.yaml @@ -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