mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-24 01:15:35 +02:00
Use isolated docker config in test sandbox (#700)
* Introduce DOCKER_CONFIG_FILE in test-suite * Set DOCKER_CONFIG_FILE in CI --------- Co-authored-by: Frederik Ring <frederik.ring@gmail.com>
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -23,6 +23,8 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
|
env:
|
||||||
|
DOCKER_CONFIG_FILE: /home/runner/.docker/config.json
|
||||||
working-directory: ./test
|
working-directory: ./test
|
||||||
run: |
|
run: |
|
||||||
BUILD_IMAGE=1 ./test.sh
|
BUILD_IMAGE=1 ./test.sh
|
||||||
|
|||||||
@@ -41,6 +41,15 @@ IMAGE_TAG=v2.30.0 ./test.sh
|
|||||||
|
|
||||||
By default, two local images are created that persist the image data and provide it to containers at runtime.
|
By default, two local images are created that persist the image data and provide it to containers at runtime.
|
||||||
|
|
||||||
|
#### `DOCKER_CONFIG_FILE`
|
||||||
|
|
||||||
|
By default, the sandbox uses an empty Docker config file (`./docker-config.json`).
|
||||||
|
To use host credentials (e.g. in CI), set `DOCKER_CONFIG_FILE` to the desired `config.json` location:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
DOCKER_CONFIG_FILE=${HOME}/.docker/config.json ./test.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Understanding the test setup
|
## Understanding the test setup
|
||||||
|
|
||||||
The test setup runs each test case in an isolated Docker container, which itself is running an otherwise unused Docker daemon.
|
The test setup runs each test case in an isolated Docker container, which itself is running an otherwise unused Docker daemon.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ services:
|
|||||||
retries: 50
|
retries: 50
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/code
|
- ./:/code
|
||||||
- ${HOME}/.docker/config.json:/root/.docker/config.json
|
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
|
||||||
- ${TARBALL:-.}:/cache/image.tar.gz
|
- ${TARBALL:-.}:/cache/image.tar.gz
|
||||||
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
||||||
- docker_volume_backup_test_sandbox_containerd:/var/lib/docker/containerd
|
- docker_volume_backup_test_sandbox_containerd:/var/lib/docker/containerd
|
||||||
@@ -20,7 +20,7 @@ services:
|
|||||||
hostname: worker1
|
hostname: worker1
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/code
|
- ./:/code
|
||||||
- ${HOME}/.docker/config.json:/root/.docker/config.json
|
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
|
||||||
- ${TARBALL:-.}:/cache/image.tar.gz
|
- ${TARBALL:-.}:/cache/image.tar.gz
|
||||||
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
||||||
- docker_volume_backup_test_sandbox_containerd_1:/var/lib/docker/containerd
|
- docker_volume_backup_test_sandbox_containerd_1:/var/lib/docker/containerd
|
||||||
@@ -31,7 +31,7 @@ services:
|
|||||||
hostname: worker2
|
hostname: worker2
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/code
|
- ./:/code
|
||||||
- ${HOME}/.docker/config.json:/root/.docker/config.json
|
- ${DOCKER_CONFIG_FILE:-./docker-config.json}:/root/.docker/config.json
|
||||||
- ${TARBALL:-.}:/cache/image.tar.gz
|
- ${TARBALL:-.}:/cache/image.tar.gz
|
||||||
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
- docker_volume_backup_test_sandbox_image:/var/lib/docker/image
|
||||||
- docker_volume_backup_test_sandbox_containerd_2:/var/lib/docker/containerd
|
- docker_volume_backup_test_sandbox_containerd_2:/var/lib/docker/containerd
|
||||||
|
|||||||
1
test/docker-config.json
Normal file
1
test/docker-config.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
Reference in New Issue
Block a user