Skip to content

Commit

Permalink
Add tests for binary data download
Browse files Browse the repository at this point in the history
  • Loading branch information
svolland-csgroup committed Jan 19, 2023
1 parent 300f1db commit b73aca4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
kubectl cp sidecar:/tmp/hello.world /tmp/hello.world
kubectl cp sidecar:/tmp/cm-kubelogo.png /tmp/cm-kubelogo.png
kubectl cp sidecar:/tmp/secret-kubelogo.png /tmp/secret-kubelogo.png
kubectl cp sidecar:/tmp/url-downloaded-kubelogo.png /tmp/url-downloaded-kubelogo.png
kubectl cp sidecar:/tmp/script_result /tmp/script_result
kubectl cp sidecar:/tmp/absolute/absolute.txt /tmp/absolute.txt
kubectl cp sidecar:/tmp/relative/relative.txt /tmp/relative.txt
Expand All @@ -134,6 +135,7 @@ jobs:
kubectl cp sidecar-5xx:/tmp-5xx/hello.world /tmp/5xx/hello.world
kubectl cp sidecar-5xx:/tmp-5xx/cm-kubelogo.png /tmp/5xx/cm-kubelogo.png
kubectl cp sidecar-5xx:/tmp-5xx/secret-kubelogo.png /tmp/5xx/secret-kubelogo.png
kubectl cp sidecar-5xx:/tmp-5xx/url-downloaded-kubelogo.png /tmp/5xx/url-downloaded-kubelogo.png
# script also generates into '/tmp'
kubectl cp sidecar-5xx:/tmp/script_result /tmp/5xx/script_result
# absolute path in configmap points to /tmp in 'absolute-configmap'
Expand Down Expand Up @@ -169,6 +171,7 @@ jobs:
echo -n "Hello World!" | diff - /tmp/hello.world &&
diff test/kubelogo.png /tmp/cm-kubelogo.png &&
diff test/kubelogo.png /tmp/secret-kubelogo.png &&
diff test/kubelogo.png /tmp/url-downloaded-kubelogo.png &&
echo -n "This absolutely exists" | diff - /tmp/absolute.txt &&
echo -n "This relatively exists" | diff - /tmp/relative.txt &&
echo -n "This change-dir exists" | diff - /tmp/change-dir.txt &&
Expand All @@ -179,6 +182,7 @@ jobs:
echo -n "Hello World!" | diff - /tmp/5xx/hello.world &&
diff test/kubelogo.png /tmp/5xx/cm-kubelogo.png &&
diff test/kubelogo.png /tmp/5xx/secret-kubelogo.png &&
diff test/kubelogo.png /tmp/5xx/url-downloaded-kubelogo.png &&
echo -n "This absolutely exists" | diff - /tmp/5xx/absolute.txt &&
echo -n "This relatively exists" | diff - /tmp/5xx/relative.txt &&
echo -n "This change-dir exists" | diff - /tmp/5xx/change-dir.txt &&
Expand Down
10 changes: 10 additions & 0 deletions test/resources/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,13 @@ metadata:
findme: "yup"
data:
secured.txt.url: "http://dummy-server/secured"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: url-configmap-binary-download
labels:
findme: "yup"
binaryData:
# Base64 encoded url is 'https://github.com/kiwigrid/k8s-sidecar/raw/master/test/kubelogo.png'
url-downloaded-kubelogo.png.url: "aHR0cHM6Ly9naXRodWIuY29tL2tpd2lncmlkL2s4cy1zaWRlY2FyL3Jhdy9tYXN0ZXIvdGVzdC9rdWJlbG9nby5wbmc="

0 comments on commit b73aca4

Please sign in to comment.