From 2ad7daa81f4b39402fa454dbb671eb8034ad9803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Galv=C3=A3o?= Date: Sat, 21 Dec 2019 23:29:39 -0300 Subject: [PATCH] Test variable interpolation in the YAML --- .../docker-compose-colon-question-error.yml | 8 ++++++++ .../docker-compose-question-error.yml | 8 ++++++++ tests/interpolation/docker-compose.yml | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 tests/interpolation/docker-compose-colon-question-error.yml create mode 100644 tests/interpolation/docker-compose-question-error.yml create mode 100644 tests/interpolation/docker-compose.yml diff --git a/tests/interpolation/docker-compose-colon-question-error.yml b/tests/interpolation/docker-compose-colon-question-error.yml new file mode 100644 index 0000000..7761f45 --- /dev/null +++ b/tests/interpolation/docker-compose-colon-question-error.yml @@ -0,0 +1,8 @@ +version: "3.7" +services: + variables: + image: busybox + command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"] + environment: + EXAMPLE_COLON_QUESTION_ERROR: ${NOT_A_VARIABLE:?Missing variable} + diff --git a/tests/interpolation/docker-compose-question-error.yml b/tests/interpolation/docker-compose-question-error.yml new file mode 100644 index 0000000..ea07072 --- /dev/null +++ b/tests/interpolation/docker-compose-question-error.yml @@ -0,0 +1,8 @@ +version: "3.7" +services: + variables: + image: busybox + command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"] + environment: + EXAMPLE_QUESTION_ERROR: ${NOT_A_VARIABLE?Missing variable} + diff --git a/tests/interpolation/docker-compose.yml b/tests/interpolation/docker-compose.yml new file mode 100644 index 0000000..c5358e0 --- /dev/null +++ b/tests/interpolation/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.7" +services: + variables: + image: busybox + command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"] + environment: + EXAMPLE_VARIABLE: "Host user: $USER" + EXAMPLE_BRACES: "Host user: ${USER}" + EXAMPLE_COLON_DASH_DEFAULT: ${NOT_A_VARIABLE:-My default} + EXAMPLE_DASH_DEFAULT: ${NOT_A_VARIABLE-My other default} + EXAMPLE_DOT_ENV: $DOT_ENV_VARIABLE + EXAMPLE_LITERAL: This is a $$literal + EXAMPLE_EMPTY: $NOT_A_VARIABLE +