Skip to content

Commit 38d0749

Browse files
committed
Introduce DOCKER_CONFIG_FILE in test suite
1 parent 36b7b63 commit 38d0749

File tree

5 files changed

+11
-32
lines changed

5 files changed

+11
-32
lines changed

test/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ IMAGE_TAG=v2.30.0 ./test.sh
4141

4242
By default, two local images are created that persist the image data and provide it to containers at runtime.
4343

44-
#### `ISOLATE_DOCKER_CONFIG`
44+
#### `DOCKER_CONFIG_FILE`
4545

46-
By default, the sandbox mounts `${HOME}/.docker/config.json` so host credentials are available.
47-
In case your local docker config is not compatible with this behaviour, you can force an empty Docker config in the run by setting `ISOLATE_DOCKER_CONFIG=1 ./test.sh`.
46+
By default, the sandbox uses an empty Docker config file (`./docker-config.json`).
47+
To use host credentials (e.g. in CI), set `DOCKER_CONFIG_FILE` to the desired `config.json` location:
48+
49+
```sh
50+
DOCKER_CONFIG_FILE=${HOME}/.docker/config.json ./test.sh
51+
```
4852

4953
## Understanding the test setup
5054

test/docker-compose.isolated.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
retries: 50
1111
volumes:
1212
- ./:/code
13-
- ${HOME}/.docker/config.json:/root/.docker/config.json
13+
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
1414
- ${TARBALL:-.}:/cache/image.tar.gz
1515
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
1616
- docker_volume_backup_test_sandbox_containerd:/var/lib/docker/containerd
@@ -20,7 +20,7 @@ services:
2020
hostname: worker1
2121
volumes:
2222
- ./:/code
23-
- ${HOME}/.docker/config.json:/root/.docker/config.json
23+
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
2424
- ${TARBALL:-.}:/cache/image.tar.gz
2525
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
2626
- docker_volume_backup_test_sandbox_containerd_1:/var/lib/docker/containerd
@@ -31,7 +31,7 @@ services:
3131
hostname: worker2
3232
volumes:
3333
- ./:/code
34-
- ${HOME}/.docker/config.json:/root/.docker/config.json
34+
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
3535
- ${TARBALL:-.}:/cache/image.tar.gz
3636
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
3737
- docker_volume_backup_test_sandbox_containerd_2:/var/lib/docker/containerd

test/docker-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

test/test.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@ set -e
44

55
MATCH_PATTERN=$1
66
IMAGE_TAG=${IMAGE_TAG:-canary}
7-
ISOLATE_DOCKER_CONFIG=${ISOLATE_DOCKER_CONFIG:-}
87

98
sandbox="docker_volume_backup_test_sandbox"
109
tarball="$(mktemp -d)/image.tar.gz"
1110
compose_profile="default"
1211
compose_files="-f docker-compose.yml"
1312

14-
if [ -n "$ISOLATE_DOCKER_CONFIG" ]; then
15-
compose_files="$compose_files -f docker-compose.isolated.yml"
16-
fi
17-
1813
trap finish EXIT INT TERM
1914

2015
finish () {

0 commit comments

Comments
 (0)