From 0e3fedbbe744fcc7025415bc0865d3cf6d4ee023 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Fri, 19 Jan 2024 14:28:06 -0500 Subject: [PATCH] ci(db): clean up database container after test run (#222) * docs(testing): update local development test docs for container cleanup * update CI actions * update host/port in userhosts example --- .github/workflows/pr-ci.yaml | 6 ++++-- .github/workflows/push-ci.yaml | 6 ++++-- README.md | 14 ++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-ci.yaml b/.github/workflows/pr-ci.yaml index b6938d718..794cee13e 100644 --- a/.github/workflows/pr-ci.yaml +++ b/.github/workflows/pr-ci.yaml @@ -99,7 +99,6 @@ jobs: matrix: java: [ '17', '21' ] env: - TESTCONTAINERS_RYUK_DISABLED: true cache-name: cache-yarn name: Build and test Java ${{ matrix.java }} permissions: @@ -152,7 +151,10 @@ jobs: chmod +x $HOME/.bin/docker echo "PATH=$HOME/.bin:$PATH" >> "$GITHUB_ENV" - name: Set up testcontainers for podman - run: echo ryuk.container.privileged=true > ~/.testcontainers.properties + run: | + echo ryuk.container.privileged=true > ~/.testcontainers.properties + echo docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy >> ~/.testcontainers.properties + echo testcontainers.reuse.enable=false >> ~/.testcontainers.properties - name: Start Podman API run: systemctl --user enable --now podman.socket - name: Set DOCKER_HOST environment variable diff --git a/.github/workflows/push-ci.yaml b/.github/workflows/push-ci.yaml index 5eca15183..df3f0ac6f 100644 --- a/.github/workflows/push-ci.yaml +++ b/.github/workflows/push-ci.yaml @@ -44,7 +44,6 @@ jobs: java: [ '17', '21' ] env: IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} - TESTCONTAINERS_RYUK_DISABLED: true cache-name: cache-yarn name: Build and test Java ${{ matrix.java }} permissions: @@ -94,7 +93,10 @@ jobs: chmod +x $HOME/.bin/docker echo "PATH=$HOME/.bin:$PATH" >> "$GITHUB_ENV" - name: Set up testcontainers for podman - run: echo ryuk.container.privileged=true > ~/.testcontainers.properties + run: | + echo ryuk.container.privileged=true > ~/.testcontainers.properties + echo docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy >> ~/.testcontainers.properties + echo testcontainers.reuse.enable=false >> ~/.testcontainers.properties - name: Start Podman API run: systemctl --user enable --now podman.socket - name: Set DOCKER_HOST environment variable diff --git a/README.md b/README.md index 09a402653..efe426d78 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,13 @@ $ systemctl --user enable --now podman.socket `$HOME/.bashrc` (or equivalent shell configuration) ```bash export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock -export TESTCONTAINERS_RYUK_DISABLED=true +``` + +`$HOME/.testcontainers.properties` +```properties +ryuk.container.privileged=true +docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy +testcontainers.reuse.enable=false ``` Build the container image and run smoketests. This will spin up the cryostat container and its required services. @@ -114,9 +120,9 @@ $ export LD_PRELOAD=$HOME/bin/lib/libuserhosts.so You can verify that this setup works by running `smoketest.bash`, and then in another terminal: ```bash -$ LD_PRELOAD=$HOME/bin/libuserhosts.so ping cryostat3 -$ LD_PRELOAD=$HOME/bin/libuserhosts.so curl http://cryostat3:8181 -$ LD_PRELOAD=$HOME/bin/libuserhosts.so firefox http://cryostat3:8181 +$ LD_PRELOAD=$HOME/bin/libuserhosts.so ping auth +$ LD_PRELOAD=$HOME/bin/libuserhosts.so curl http://auth:8080 +$ LD_PRELOAD=$HOME/bin/libuserhosts.so firefox http://auth:8080 ``` ### Smoketesting in K8s