From 5481fbb973683d473ec95e25bddcdef03dfe422d Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Mon, 25 Mar 2024 12:26:37 +0000 Subject: [PATCH] Test that we pull in env host variables Now that clear env variables specified on the command line we can check that values specified as `${VAR}` are pulled in from the host. --- test/integration/docker/deployer/app/config/deploy.yml | 3 ++- test/integration/docker/vm/Dockerfile | 2 ++ test/integration/main_test.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/docker/deployer/app/config/deploy.yml b/test/integration/docker/deployer/app/config/deploy.yml index baedca99..11e2cf04 100644 --- a/test/integration/docker/deployer/app/config/deploy.yml +++ b/test/integration/docker/deployer/app/config/deploy.yml @@ -5,7 +5,8 @@ servers: - vm2 env: clear: - CLEAR_TOKEN: '4321' + CLEAR_TOKEN: 4321 + HOST_TOKEN: "${HOST_TOKEN}" secret: - SECRET_TOKEN asset_path: /usr/share/nginx/html/versions diff --git a/test/integration/docker/vm/Dockerfile b/test/integration/docker/vm/Dockerfile index e6a0c6cd..584a7b6a 100644 --- a/test/integration/docker/vm/Dockerfile +++ b/test/integration/docker/vm/Dockerfile @@ -7,6 +7,8 @@ RUN apt-get update --fix-missing && apt-get -y install openssh-client openssh-se RUN mkdir /root/.ssh && ln -s /shared/ssh/id_rsa.pub /root/.ssh/authorized_keys RUN mkdir -p /etc/docker/certs.d/registry:4443 && ln -s /shared/certs/domain.crt /etc/docker/certs.d/registry:4443/ca.crt +RUN echo "HOST_TOKEN=abcd" >> /etc/environment + COPY boot.sh . HEALTHCHECK --interval=1s CMD pgrep dockerd diff --git a/test/integration/main_test.rb b/test/integration/main_test.rb index e4f8db61..f8f69b0e 100644 --- a/test/integration/main_test.rb +++ b/test/integration/main_test.rb @@ -15,6 +15,7 @@ class MainTest < IntegrationTest assert_app_is_up version: first_version assert_hooks_ran "pre-connect", "pre-build", "pre-deploy", "post-deploy" assert_env :CLEAR_TOKEN, "4321", version: first_version + assert_env :HOST_TOKEN, "abcd", version: first_version assert_env :SECRET_TOKEN, "1234", version: first_version second_version = update_app_rev