From 709d8d411ccab90c6326a8be2d7370669b96a2cb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Sep 2021 00:05:41 -0400 Subject: [PATCH 1/5] fix: mount correct path for DOKKU_HOST_ROOT --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 756124adf..7af15371b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "context": ".." }, "containerEnv": { - "DOKKU_HOST_ROOT": "${localWorkspaceFolder}/tmp/data", + "DOKKU_HOST_ROOT": "${localWorkspaceFolder}/tmp/data/home/dokku", "GO_ROOT_MOUNT": "${localWorkspaceFolder}:/go/src/github.com/dokku/dokku" }, "initializeCommand": ["mkdir", "-p", "tmp/data"], From 4a8ed5cd065e6a4db5deedfbd768b8ca31321a1b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Sep 2021 00:05:57 -0400 Subject: [PATCH 2/5] feat: add uuid-runtime to fix random id generation in tests --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7df43cb9d..952c4f312 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ FROM dokku/dokku:latest RUN apt-get update RUN apt-get install --no-install-recommends -y build-essential file nano && \ - apt-get install --no-install-recommends -y shellcheck xmlstarlet && \ + apt-get install --no-install-recommends -y shellcheck uuid-runtime xmlstarlet && \ apt-get clean autoclean && \ apt-get autoremove --yes && \ rm -rf /var/lib/apt/lists/* From 974f601fa94d7e13173a253f2ab6de378179fec3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Sep 2021 00:07:02 -0400 Subject: [PATCH 3/5] dev: speed up devcontainer building by only copying the tests.mk file as Makefile first --- .devcontainer/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 952c4f312..ac47a30bd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,8 +10,9 @@ RUN apt-get install --no-install-recommends -y build-essential file nano && \ ADD https://raw.githubusercontent.com/dokku/dokku/master/tests/dhparam.pem /mnt/dokku/etc/nginx/dhparam.pem COPY .devcontainer/bin/ /usr/local/bin/ -COPY . . - +COPY ["tests.mk", "Makefile"] RUN make ci-dependencies -ENV DOKKU_HOSTNAME=dokku.me +COPY . . + +ENV DOKKU_HOSTNAME=dokku.me \ No newline at end of file From d83471bd461f975153fbdeee70b0bfb47749bcf5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Sep 2021 00:24:29 -0400 Subject: [PATCH 4/5] fix: do not delete devcontainers when running tests in a docker container --- .devcontainer/Dockerfile | 3 ++- tests/unit/test_helper.bash | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ac47a30bd..a6e5b1d17 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,4 +15,5 @@ RUN make ci-dependencies COPY . . -ENV DOKKU_HOSTNAME=dokku.me \ No newline at end of file +ENV DOKKU_HOSTNAME=dokku.me +LABEL org.label-schema.schema-version=1.0 org.label-schema.vendor=dokku com.dokku.devcontainer=true diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 254c2d0c0..5108705c0 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -43,7 +43,7 @@ cleanup_apps() { cleanup_containers() { containers=$(docker container ls --quiet) if [[ -n "$containers" ]]; then - docker container ls --quiet | xargs -n1 docker container rm -f || true + docker inspect -f '{{ if ne "true" (index .Config.Labels "com.dokku.devcontainer") }}{{.ID}} {{ end }}' $(docker ps -q) | xargs --no-run-if-empty -n1 docker container rm -f || true fi } From 2d180f5e0ff2b223117cf54f8c4ed384bbcdc003 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Sep 2021 00:24:43 -0400 Subject: [PATCH 5/5] tests: remove extra call to list apps --- tests/unit/test_helper.bash | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 5108705c0..da08bfff6 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -34,10 +34,7 @@ global_teardown() { cleanup_apps() { rm -rf $DOKKU_ROOT/*/nginx.conf - apps=$(dokku --quiet apps:list) - if [[ -n "${apps}" ]]; then - dokku --quiet apps:list | xargs -n1 dokku --force apps:destroy - fi + dokku --quiet apps:list | xargs --no-run-if-empty -n1 dokku --force apps:destroy } cleanup_containers() {