From b73aca400f3ab28456e5289c822eae8033525b91 Mon Sep 17 00:00:00 2001 From: Sun Volland Date: Thu, 19 Jan 2023 16:43:29 +0100 Subject: [PATCH] Add tests for binary data download --- .github/workflows/build_and_test.yaml | 4 ++++ test/resources/resources.yaml | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index a11b04e..b166cc3 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -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 @@ -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' @@ -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 && @@ -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 && diff --git a/test/resources/resources.yaml b/test/resources/resources.yaml index 1326440..8c59b20 100644 --- a/test/resources/resources.yaml +++ b/test/resources/resources.yaml @@ -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="