Skip to content

Commit

Permalink
ci(db): clean up database container after test run (#222)
Browse files Browse the repository at this point in the history
* docs(testing): update local development test docs for container cleanup

* update CI actions

* update host/port in userhosts example
  • Loading branch information
andrewazores authored Jan 19, 2024
1 parent 997f141 commit 0e3fedb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pr-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/push-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 0e3fedb

Please sign in to comment.