mirror of
https://github.com/docker/compose.git
synced 2025-07-27 15:44:08 +02:00
Pin test images on a non rolling tag
Mainly busybox:latest to the current latest which is 1.31.0-uclibc Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
This commit is contained in:
parent
c8279bc4db
commit
cd098e0cad
@ -20,6 +20,7 @@ import yaml
|
|||||||
from docker import errors
|
from docker import errors
|
||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from ..helpers import create_host_file
|
from ..helpers import create_host_file
|
||||||
from compose.cli.command import get_project
|
from compose.cli.command import get_project
|
||||||
from compose.config.errors import DuplicateOverrideFileFound
|
from compose.config.errors import DuplicateOverrideFileFound
|
||||||
@ -266,7 +267,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
'volumes_from': ['service:other:rw'],
|
'volumes_from': ['service:other:rw'],
|
||||||
},
|
},
|
||||||
'other': {
|
'other': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'volumes': ['/data'],
|
'volumes': ['/data'],
|
||||||
},
|
},
|
||||||
@ -639,7 +640,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
def test_pull_with_digest(self):
|
def test_pull_with_digest(self):
|
||||||
result = self.dispatch(['-f', 'digest.yml', 'pull', '--no-parallel'])
|
result = self.dispatch(['-f', 'digest.yml', 'pull', '--no-parallel'])
|
||||||
|
|
||||||
assert 'Pulling simple (busybox:latest)...' in result.stderr
|
assert 'Pulling simple ({})...'.format(BUSYBOX_IMAGE_WITH_TAG) in result.stderr
|
||||||
assert ('Pulling digest (busybox@'
|
assert ('Pulling digest (busybox@'
|
||||||
'sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b520'
|
'sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b520'
|
||||||
'04ee8502d)...') in result.stderr
|
'04ee8502d)...') in result.stderr
|
||||||
@ -650,7 +651,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
'pull', '--ignore-pull-failures', '--no-parallel']
|
'pull', '--ignore-pull-failures', '--no-parallel']
|
||||||
)
|
)
|
||||||
|
|
||||||
assert 'Pulling simple (busybox:latest)...' in result.stderr
|
assert 'Pulling simple ({})...'.format(BUSYBOX_IMAGE_WITH_TAG) in result.stderr
|
||||||
assert 'Pulling another (nonexisting-image:latest)...' in result.stderr
|
assert 'Pulling another (nonexisting-image:latest)...' in result.stderr
|
||||||
assert ('repository nonexisting-image not found' in result.stderr or
|
assert ('repository nonexisting-image not found' in result.stderr or
|
||||||
'image library/nonexisting-image:latest not found' in result.stderr or
|
'image library/nonexisting-image:latest not found' in result.stderr or
|
||||||
@ -777,6 +778,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
]
|
]
|
||||||
assert not containers
|
assert not containers
|
||||||
|
|
||||||
|
@pytest.mark.xfail(True, reason='Flaky on local')
|
||||||
def test_build_rm(self):
|
def test_build_rm(self):
|
||||||
containers = [
|
containers = [
|
||||||
Container.from_ps(self.project.client, c)
|
Container.from_ps(self.project.client, c)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: ls .
|
command: ls .
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: ls /thecakeisalie
|
command: ls /thecakeisalie
|
||||||
|
2
tests/fixtures/build-args/Dockerfile
vendored
2
tests/fixtures/build-args/Dockerfile
vendored
@ -1,4 +1,4 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
LABEL com.docker.compose.test_image=true
|
LABEL com.docker.compose.test_image=true
|
||||||
ARG favorite_th_character
|
ARG favorite_th_character
|
||||||
RUN echo "Favorite Touhou Character: ${favorite_th_character}"
|
RUN echo "Favorite Touhou Character: ${favorite_th_character}"
|
||||||
|
2
tests/fixtures/build-ctx/Dockerfile
vendored
2
tests/fixtures/build-ctx/Dockerfile
vendored
@ -1,3 +1,3 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
LABEL com.docker.compose.test_image=true
|
LABEL com.docker.compose.test_image=true
|
||||||
CMD echo "success"
|
CMD echo "success"
|
||||||
|
2
tests/fixtures/build-memory/Dockerfile
vendored
2
tests/fixtures/build-memory/Dockerfile
vendored
@ -1,4 +1,4 @@
|
|||||||
FROM busybox
|
FROM busybox:1.31.0-uclibc
|
||||||
|
|
||||||
# Report the memory (through the size of the group memory)
|
# Report the memory (through the size of the group memory)
|
||||||
RUN echo "memory:" $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
|
RUN echo "memory:" $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
RUN echo a
|
RUN echo a
|
||||||
CMD top
|
CMD top
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
RUN echo b
|
RUN echo b
|
||||||
CMD top
|
CMD top
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
LABEL com.docker.compose.test_image=true
|
LABEL com.docker.compose.test_image=true
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
CMD top
|
CMD top
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
web:
|
web:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 100"
|
command: "sleep 100"
|
||||||
links:
|
links:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 200"
|
command: "sleep 200"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: echo simple
|
command: echo simple
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: echo another
|
command: echo another
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
LABEL com.docker.compose.test_image=true
|
LABEL com.docker.compose.test_image=true
|
||||||
ENTRYPOINT ["printf"]
|
ENTRYPOINT ["printf"]
|
||||||
CMD ["default", "args"]
|
CMD ["default", "args"]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
service:
|
service:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "echo hello && tail -f /dev/null"
|
command: sh -c "echo hello && tail -f /dev/null"
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: /bin/false
|
command: /bin/false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
expose:
|
expose:
|
||||||
- '3000'
|
- '3000'
|
||||||
|
2
tests/fixtures/images-service-tag/Dockerfile
vendored
2
tests/fixtures/images-service-tag/Dockerfile
vendored
@ -1,2 +1,2 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
RUN touch /foo
|
RUN touch /foo
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
log_driver: "none"
|
log_driver: "none"
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
log_driver: "json-file"
|
log_driver: "json-file"
|
||||||
log_opt:
|
log_opt:
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
logging:
|
logging:
|
||||||
driver: "none"
|
driver: "none"
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "sleep 1 && echo hello && tail -f /dev/null"
|
command: sh -c "sleep 1 && echo hello && tail -f /dev/null"
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "sleep 1 && echo test"
|
command: sh -c "sleep 1 && echo test"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "echo hello && tail -f /dev/null"
|
command: sh -c "echo hello && tail -f /dev/null"
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "sleep 2 && echo world && /bin/false"
|
command: sh -c "sleep 2 && echo world && /bin/false"
|
||||||
restart: "on-failure:2"
|
restart: "on-failure:2"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c "echo w && echo x && echo y && echo z"
|
command: sh -c "echo w && echo x && echo y && echo z"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
definedinyamlnotyml:
|
definedinyamlnotyml:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
yetanother:
|
yetanother:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
|
4
tests/fixtures/networks/external-default.yml
vendored
4
tests/fixtures/networks/external-default.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
db:
|
db:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
web:
|
web:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
console:
|
console:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
version: '2.2'
|
version: '2.2'
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 200"
|
command: "sleep 200"
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
db:
|
db:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 200"
|
command: "sleep 200"
|
||||||
|
2
tests/fixtures/override-files/extra.yml
vendored
2
tests/fixtures/override-files/extra.yml
vendored
@ -6,5 +6,5 @@ services:
|
|||||||
- other
|
- other
|
||||||
|
|
||||||
other:
|
other:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "top"
|
command: "top"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
web:
|
web:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 100"
|
command: "sleep 100"
|
||||||
links:
|
links:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: "sleep 200"
|
command: "sleep 200"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: /bin/sleep 300
|
command: /bin/sleep 300
|
||||||
ports:
|
ports:
|
||||||
- '3000'
|
- '3000'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
ports:
|
ports:
|
||||||
- '3000'
|
- '3000'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
version: '3.2'
|
version: '3.2'
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
ports:
|
ports:
|
||||||
- target: 3000
|
- target: 3000
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
with_image:
|
with_image:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
with_build:
|
with_build:
|
||||||
build: ../build-ctx/
|
build: ../build-ctx/
|
||||||
|
2
tests/fixtures/run-labels/docker-compose.yml
vendored
2
tests/fixtures/run-labels/docker-compose.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
service:
|
service:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
service:
|
service:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
working_dir: /etc
|
working_dir: /etc
|
||||||
command: /bin/true
|
command: /bin/true
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
version: '2.2'
|
version: '2.2'
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
volumes:
|
volumes:
|
||||||
- datastore:/data1
|
- datastore:/data1
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
|
2
tests/fixtures/simple-composefile/digest.yml
vendored
2
tests/fixtures/simple-composefile/digest.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
digest:
|
digest:
|
||||||
image: busybox@sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b52004ee8502d
|
image: busybox@sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b52004ee8502d
|
||||||
|
@ -2,5 +2,5 @@ simple:
|
|||||||
image: busybox:1.27.2
|
image: busybox:1.27.2
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
another:
|
another:
|
||||||
image: nonexisting-image:latest
|
image: nonexisting-image:latest
|
||||||
|
@ -7,5 +7,5 @@ services:
|
|||||||
from_simple:
|
from_simple:
|
||||||
image: simple
|
image: simple
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
LABEL com.docker.compose.test_image=true
|
LABEL com.docker.compose.test_image=true
|
||||||
LABEL com.docker.compose.test_failing_image=true
|
LABEL com.docker.compose.test_failing_image=true
|
||||||
# With the following label the container wil be cleaned up automatically
|
# With the following label the container wil be cleaned up automatically
|
||||||
|
@ -3,8 +3,8 @@ version: "2"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sleep 200
|
command: sleep 200
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sleep 200
|
command: sleep 200
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- '-c'
|
- '-c'
|
||||||
|
2
tests/fixtures/tagless-image/Dockerfile
vendored
2
tests/fixtures/tagless-image/Dockerfile
vendored
@ -1,2 +1,2 @@
|
|||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
RUN touch /blah
|
RUN touch /blah
|
||||||
|
4
tests/fixtures/top/docker-compose.yml
vendored
4
tests/fixtures/top/docker-compose.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
service_a:
|
service_a:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
service_b:
|
service_b:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: sh -c 'echo $$FOO'
|
command: sh -c 'echo $$FOO'
|
||||||
environment:
|
environment:
|
||||||
FOO: ${BAR}
|
FOO: ${BAR}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
service:
|
service:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
user: notauser
|
user: notauser
|
||||||
command: id
|
command: id
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
version: "2.0"
|
version: "2.0"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
web:
|
web:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
console:
|
console:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
2
tests/fixtures/v2-full/Dockerfile
vendored
2
tests/fixtures/v2-full/Dockerfile
vendored
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
FROM busybox:latest
|
FROM busybox:1.31.0-uclibc
|
||||||
RUN echo something
|
RUN echo something
|
||||||
CMD top
|
CMD top
|
||||||
|
2
tests/fixtures/v2-full/docker-compose.yml
vendored
2
tests/fixtures/v2-full/docker-compose.yml
vendored
@ -18,7 +18,7 @@ services:
|
|||||||
- other
|
- other
|
||||||
|
|
||||||
other:
|
other:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
volumes:
|
volumes:
|
||||||
- /data
|
- /data
|
||||||
|
4
tests/fixtures/v2-simple/links-invalid.yml
vendored
4
tests/fixtures/v2-simple/links-invalid.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
links:
|
links:
|
||||||
- another
|
- another
|
||||||
another:
|
another:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
2
tests/fixtures/v2-simple/one-container.yml
vendored
2
tests/fixtures/v2-simple/one-container.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
services:
|
services:
|
||||||
simple:
|
simple:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
command: top
|
command: top
|
||||||
|
@ -7,6 +7,10 @@ from compose.config.config import ConfigDetails
|
|||||||
from compose.config.config import ConfigFile
|
from compose.config.config import ConfigFile
|
||||||
from compose.config.config import load
|
from compose.config.config import load
|
||||||
|
|
||||||
|
BUSYBOX_IMAGE_NAME = 'busybox'
|
||||||
|
BUSYBOX_DEFAULT_TAG = '1.31.0-uclibc'
|
||||||
|
BUSYBOX_IMAGE_WITH_TAG = '{}:{}'.format(BUSYBOX_IMAGE_NAME, BUSYBOX_DEFAULT_TAG)
|
||||||
|
|
||||||
|
|
||||||
def build_config(contents, **kwargs):
|
def build_config(contents, **kwargs):
|
||||||
return load(build_config_details(contents, **kwargs))
|
return load(build_config_details(contents, **kwargs))
|
||||||
@ -22,7 +26,7 @@ def build_config_details(contents, working_dir='working_dir', filename='filename
|
|||||||
def create_custom_host_file(client, filename, content):
|
def create_custom_host_file(client, filename, content):
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.dirname(filename)
|
||||||
container = client.create_container(
|
container = client.create_container(
|
||||||
'busybox:latest',
|
BUSYBOX_IMAGE_WITH_TAG,
|
||||||
['sh', '-c', 'echo -n "{}" > {}'.format(content, filename)],
|
['sh', '-c', 'echo -n "{}" > {}'.format(content, filename)],
|
||||||
volumes={dirname: {}},
|
volumes={dirname: {}},
|
||||||
host_config=client.create_host_config(
|
host_config=client.create_host_config(
|
||||||
|
@ -20,7 +20,7 @@ class EnvironmentTest(DockerClientTestCase):
|
|||||||
cls.compose_file.write(bytes("""version: '3.2'
|
cls.compose_file.write(bytes("""version: '3.2'
|
||||||
services:
|
services:
|
||||||
svc:
|
svc:
|
||||||
image: busybox:latest
|
image: busybox:1.31.0-uclibc
|
||||||
environment:
|
environment:
|
||||||
TEST_VARIABLE: ${TEST_VARIABLE}""", encoding='utf-8'))
|
TEST_VARIABLE: ${TEST_VARIABLE}""", encoding='utf-8'))
|
||||||
cls.compose_file.flush()
|
cls.compose_file.flush()
|
||||||
|
@ -15,6 +15,7 @@ from docker.errors import NotFound
|
|||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
from ..helpers import build_config as load_config
|
from ..helpers import build_config as load_config
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from ..helpers import create_host_file
|
from ..helpers import create_host_file
|
||||||
from .testcases import DockerClientTestCase
|
from .testcases import DockerClientTestCase
|
||||||
from .testcases import SWARM_SKIP_CONTAINERS_ALL
|
from .testcases import SWARM_SKIP_CONTAINERS_ALL
|
||||||
@ -128,11 +129,11 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'data': {
|
'data': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': ['/var/data'],
|
'volumes': ['/var/data'],
|
||||||
},
|
},
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': ['data'],
|
'volumes_from': ['data'],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -145,7 +146,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
def test_volumes_from_container(self):
|
def test_volumes_from_container(self):
|
||||||
data_container = Container.create(
|
data_container = Container.create(
|
||||||
self.client,
|
self.client,
|
||||||
image='busybox:latest',
|
image=BUSYBOX_IMAGE_WITH_TAG,
|
||||||
volumes=['/var/data'],
|
volumes=['/var/data'],
|
||||||
name='composetest_data_container',
|
name='composetest_data_container',
|
||||||
labels={LABEL_PROJECT: 'composetest'},
|
labels={LABEL_PROJECT: 'composetest'},
|
||||||
@ -155,7 +156,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': ['composetest_data_container'],
|
'volumes_from': ['composetest_data_container'],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -174,11 +175,11 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': str(V2_0),
|
'version': str(V2_0),
|
||||||
'services': {
|
'services': {
|
||||||
'net': {
|
'net': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'network_mode': 'service:net',
|
'network_mode': 'service:net',
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
@ -202,7 +203,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': str(V2_0),
|
'version': str(V2_0),
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'network_mode': 'container:composetest_net_container'
|
'network_mode': 'container:composetest_net_container'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -217,7 +218,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
|
|
||||||
net_container = Container.create(
|
net_container = Container.create(
|
||||||
self.client,
|
self.client,
|
||||||
image='busybox:latest',
|
image=BUSYBOX_IMAGE_WITH_TAG,
|
||||||
name='composetest_net_container',
|
name='composetest_net_container',
|
||||||
command='top',
|
command='top',
|
||||||
labels={LABEL_PROJECT: 'composetest'},
|
labels={LABEL_PROJECT: 'composetest'},
|
||||||
@ -237,11 +238,11 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'net': {
|
'net': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'net': 'container:net',
|
'net': 'container:net',
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
@ -262,7 +263,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'net': 'container:composetest_net_container'
|
'net': 'container:composetest_net_container'
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -276,7 +277,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
|
|
||||||
net_container = Container.create(
|
net_container = Container.create(
|
||||||
self.client,
|
self.client,
|
||||||
image='busybox:latest',
|
image=BUSYBOX_IMAGE_WITH_TAG,
|
||||||
name='composetest_net_container',
|
name='composetest_net_container',
|
||||||
command='top',
|
command='top',
|
||||||
labels={LABEL_PROJECT: 'composetest'},
|
labels={LABEL_PROJECT: 'composetest'},
|
||||||
@ -549,20 +550,20 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'console': {
|
'console': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
},
|
},
|
||||||
'data': {
|
'data': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
'volumes_from': ['data'],
|
'volumes_from': ['data'],
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
'links': ['db'],
|
'links': ['db'],
|
||||||
},
|
},
|
||||||
@ -584,20 +585,20 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=load_config({
|
config_data=load_config({
|
||||||
'console': {
|
'console': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
},
|
},
|
||||||
'data': {
|
'data': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"]
|
'command': ["top"]
|
||||||
},
|
},
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
'volumes_from': ['data'],
|
'volumes_from': ['data'],
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': ["top"],
|
'command': ["top"],
|
||||||
'links': ['db'],
|
'links': ['db'],
|
||||||
},
|
},
|
||||||
@ -623,7 +624,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.1',
|
'version': '2.1',
|
||||||
'services': {
|
'services': {
|
||||||
'foo': {
|
'foo': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'tmpfs': ['/dev/shm'],
|
'tmpfs': ['/dev/shm'],
|
||||||
'volumes': ['/dev/shm']
|
'volumes': ['/dev/shm']
|
||||||
}
|
}
|
||||||
@ -664,7 +665,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'networks': {
|
'networks': {
|
||||||
'foo': None,
|
'foo': None,
|
||||||
@ -709,7 +710,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {'front': None},
|
'networks': {'front': None},
|
||||||
}],
|
}],
|
||||||
networks={
|
networks={
|
||||||
@ -769,7 +770,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {'front': None},
|
'networks': {'front': None},
|
||||||
}],
|
}],
|
||||||
networks={
|
networks={
|
||||||
@ -804,7 +805,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'networks': {
|
'networks': {
|
||||||
'static_test': {
|
'static_test': {
|
||||||
@ -856,7 +857,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_3,
|
version=V2_3,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {
|
'networks': {
|
||||||
'n1': {
|
'n1': {
|
||||||
'priority': p1,
|
'priority': p1,
|
||||||
@ -919,7 +920,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'networks': {
|
'networks': {
|
||||||
'static_test': {
|
'static_test': {
|
||||||
@ -962,7 +963,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {
|
'networks': {
|
||||||
'static_test': {
|
'static_test': {
|
||||||
'ipv4_address': '172.16.100.100',
|
'ipv4_address': '172.16.100.100',
|
||||||
@ -998,7 +999,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {
|
'networks': {
|
||||||
'linklocaltest': {
|
'linklocaltest': {
|
||||||
'link_local_ips': ['169.254.8.8']
|
'link_local_ips': ['169.254.8.8']
|
||||||
@ -1035,7 +1036,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'name': 'web',
|
'name': 'web',
|
||||||
'volumes': [VolumeSpec.parse('foo:/container-path')],
|
'volumes': [VolumeSpec.parse('foo:/container-path')],
|
||||||
'networks': {'foo': {}},
|
'networks': {'foo': {}},
|
||||||
'image': 'busybox:latest'
|
'image': BUSYBOX_IMAGE_WITH_TAG
|
||||||
}],
|
}],
|
||||||
networks={
|
networks={
|
||||||
'foo': {
|
'foo': {
|
||||||
@ -1071,7 +1072,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'isolation': 'default'
|
'isolation': 'default'
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
@ -1091,7 +1092,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'isolation': 'foobar'
|
'isolation': 'foobar'
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
@ -1111,7 +1112,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_3,
|
version=V2_3,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'runtime': 'runc'
|
'runtime': 'runc'
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
@ -1131,7 +1132,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_3,
|
version=V2_3,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'runtime': 'foobar'
|
'runtime': 'foobar'
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
@ -1151,7 +1152,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_3,
|
version=V2_3,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'runtime': 'nvidia'
|
'runtime': 'nvidia'
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
@ -1171,7 +1172,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {'internal': None},
|
'networks': {'internal': None},
|
||||||
}],
|
}],
|
||||||
networks={
|
networks={
|
||||||
@ -1200,7 +1201,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {network_name: None}
|
'networks': {network_name: None}
|
||||||
}],
|
}],
|
||||||
networks={
|
networks={
|
||||||
@ -1233,7 +1234,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {'driver': 'local'}},
|
volumes={vol_name: {'driver': 'local'}},
|
||||||
@ -1260,7 +1261,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_1,
|
version=V2_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': [VolumeSpec.parse('{}:/data'.format(volume_name))]
|
'volumes': [VolumeSpec.parse('{}:/data'.format(volume_name))]
|
||||||
}],
|
}],
|
||||||
volumes={
|
volumes={
|
||||||
@ -1299,9 +1300,9 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
{
|
{
|
||||||
'version': str(V2_0),
|
'version': str(V2_0),
|
||||||
'services': {
|
'services': {
|
||||||
'simple': {'image': 'busybox:latest', 'command': 'top'},
|
'simple': {'image': BUSYBOX_IMAGE_WITH_TAG, 'command': 'top'},
|
||||||
'another': {
|
'another': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'logging': {
|
'logging': {
|
||||||
'driver': "json-file",
|
'driver': "json-file",
|
||||||
@ -1352,7 +1353,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': str(V2_0),
|
'version': str(V2_0),
|
||||||
'services': {
|
'services': {
|
||||||
'simple': {
|
'simple': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'ports': ['1234:1234']
|
'ports': ['1234:1234']
|
||||||
},
|
},
|
||||||
@ -1386,7 +1387,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_2,
|
version=V2_2,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'scale': 3
|
'scale': 3
|
||||||
}]
|
}]
|
||||||
@ -1416,7 +1417,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {}},
|
volumes={vol_name: {}},
|
||||||
@ -1440,7 +1441,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {}},
|
volumes={vol_name: {}},
|
||||||
@ -1464,7 +1465,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V3_1,
|
version=V3_1,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'cat /run/secrets/special',
|
'command': 'cat /run/secrets/special',
|
||||||
'secrets': [
|
'secrets': [
|
||||||
types.ServiceSecret.parse({'source': 'super', 'target': 'special'}),
|
types.ServiceSecret.parse({'source': 'super', 'target': 'special'}),
|
||||||
@ -1502,7 +1503,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'services': [
|
'services': [
|
||||||
{
|
{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'cat /run/secrets/special',
|
'command': 'cat /run/secrets/special',
|
||||||
'environment': ['constraint:node=={}'.format(node if node is not None else '')]
|
'environment': ['constraint:node=={}'.format(node if node is not None else '')]
|
||||||
}
|
}
|
||||||
@ -1555,7 +1556,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {'driver': 'foobar'}},
|
volumes={vol_name: {'driver': 'foobar'}},
|
||||||
@ -1578,7 +1579,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {'driver': 'local'}},
|
volumes={vol_name: {'driver': 'local'}},
|
||||||
@ -1620,7 +1621,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={
|
volumes={
|
||||||
@ -1662,7 +1663,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={vol_name: {'driver': 'local'}},
|
volumes={vol_name: {'driver': 'local'}},
|
||||||
@ -1701,7 +1702,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={
|
volumes={
|
||||||
@ -1725,7 +1726,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top'
|
'command': 'top'
|
||||||
}],
|
}],
|
||||||
volumes={
|
volumes={
|
||||||
@ -1753,7 +1754,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': str(V2_0),
|
'version': str(V2_0),
|
||||||
'services': {
|
'services': {
|
||||||
'simple': {
|
'simple': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'volumes': ['{0}:/data'.format(vol_name)]
|
'volumes': ['{0}:/data'.format(vol_name)]
|
||||||
},
|
},
|
||||||
@ -1782,7 +1783,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
def test_project_up_orphans(self):
|
def test_project_up_orphans(self):
|
||||||
config_dict = {
|
config_dict = {
|
||||||
'service1': {
|
'service1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1819,7 +1820,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
def test_project_up_ignore_orphans(self):
|
def test_project_up_ignore_orphans(self):
|
||||||
config_dict = {
|
config_dict = {
|
||||||
'service1': {
|
'service1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1847,7 +1848,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.1',
|
'version': '2.1',
|
||||||
'services': {
|
'services': {
|
||||||
'svc1': {
|
'svc1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'healthcheck': {
|
'healthcheck': {
|
||||||
'test': 'exit 0',
|
'test': 'exit 0',
|
||||||
@ -1857,7 +1858,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'svc2': {
|
'svc2': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'depends_on': {
|
'depends_on': {
|
||||||
'svc1': {'condition': 'service_healthy'},
|
'svc1': {'condition': 'service_healthy'},
|
||||||
@ -1884,7 +1885,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.1',
|
'version': '2.1',
|
||||||
'services': {
|
'services': {
|
||||||
'svc1': {
|
'svc1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'healthcheck': {
|
'healthcheck': {
|
||||||
'test': 'exit 1',
|
'test': 'exit 1',
|
||||||
@ -1894,7 +1895,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'svc2': {
|
'svc2': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'depends_on': {
|
'depends_on': {
|
||||||
'svc1': {'condition': 'service_healthy'},
|
'svc1': {'condition': 'service_healthy'},
|
||||||
@ -1923,14 +1924,14 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.1',
|
'version': '2.1',
|
||||||
'services': {
|
'services': {
|
||||||
'svc1': {
|
'svc1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'healthcheck': {
|
'healthcheck': {
|
||||||
'disable': True
|
'disable': True
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'svc2': {
|
'svc2': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'depends_on': {
|
'depends_on': {
|
||||||
'svc1': {'condition': 'service_healthy'},
|
'svc1': {'condition': 'service_healthy'},
|
||||||
@ -1967,7 +1968,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.3',
|
'version': '2.3',
|
||||||
'services': {
|
'services': {
|
||||||
'svc1': {
|
'svc1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'security_opt': ['seccomp:"{}"'.format(profile_path)]
|
'security_opt': ['seccomp:"{}"'.format(profile_path)]
|
||||||
}
|
}
|
||||||
@ -1991,7 +1992,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
'version': '2.3',
|
'version': '2.3',
|
||||||
'services': {
|
'services': {
|
||||||
'svc1': {
|
'svc1': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'ls',
|
'command': 'ls',
|
||||||
'volumes': ['foo:/foo:rw'],
|
'volumes': ['foo:/foo:rw'],
|
||||||
'networks': ['bar'],
|
'networks': ['bar'],
|
||||||
|
@ -15,6 +15,7 @@ from six import StringIO
|
|||||||
from six import text_type
|
from six import text_type
|
||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from .testcases import docker_client
|
from .testcases import docker_client
|
||||||
from .testcases import DockerClientTestCase
|
from .testcases import DockerClientTestCase
|
||||||
from .testcases import get_links
|
from .testcases import get_links
|
||||||
@ -373,7 +374,7 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
self.client.create_volume(volume_name)
|
self.client.create_volume(volume_name)
|
||||||
service = Service('db', client=client, volumes=[
|
service = Service('db', client=client, volumes=[
|
||||||
MountSpec(type='volume', source=volume_name, target=container_path)
|
MountSpec(type='volume', source=volume_name, target=container_path)
|
||||||
], image='busybox:latest', command=['top'], project='composetest')
|
], image=BUSYBOX_IMAGE_WITH_TAG, command=['top'], project='composetest')
|
||||||
container = service.create_container()
|
container = service.create_container()
|
||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
mount = container.get_mount(container_path)
|
mount = container.get_mount(container_path)
|
||||||
@ -388,7 +389,7 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
container_path = '/container-tmpfs'
|
container_path = '/container-tmpfs'
|
||||||
service = Service('db', client=client, volumes=[
|
service = Service('db', client=client, volumes=[
|
||||||
MountSpec(type='tmpfs', target=container_path)
|
MountSpec(type='tmpfs', target=container_path)
|
||||||
], image='busybox:latest', command=['top'], project='composetest')
|
], image=BUSYBOX_IMAGE_WITH_TAG, command=['top'], project='composetest')
|
||||||
container = service.create_container()
|
container = service.create_container()
|
||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
mount = container.get_mount(container_path)
|
mount = container.get_mount(container_path)
|
||||||
@ -474,7 +475,7 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
volume_container_1 = volume_service.create_container()
|
volume_container_1 = volume_service.create_container()
|
||||||
volume_container_2 = Container.create(
|
volume_container_2 = Container.create(
|
||||||
self.client,
|
self.client,
|
||||||
image='busybox:latest',
|
image=BUSYBOX_IMAGE_WITH_TAG,
|
||||||
command=["top"],
|
command=["top"],
|
||||||
labels={LABEL_PROJECT: 'composetest'},
|
labels={LABEL_PROJECT: 'composetest'},
|
||||||
host_config={},
|
host_config={},
|
||||||
@ -1232,9 +1233,8 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
# })
|
# })
|
||||||
|
|
||||||
def test_create_with_image_id(self):
|
def test_create_with_image_id(self):
|
||||||
# Get image id for the current busybox:latest
|
|
||||||
pull_busybox(self.client)
|
pull_busybox(self.client)
|
||||||
image_id = self.client.inspect_image('busybox:latest')['Id'][:12]
|
image_id = self.client.inspect_image(BUSYBOX_IMAGE_WITH_TAG)['Id'][:12]
|
||||||
service = self.create_service('foo', image=image_id)
|
service = self.create_service('foo', image=image_id)
|
||||||
service.create_container()
|
service.create_container()
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import copy
|
|||||||
import py
|
import py
|
||||||
from docker.errors import ImageNotFound
|
from docker.errors import ImageNotFound
|
||||||
|
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from .testcases import DockerClientTestCase
|
from .testcases import DockerClientTestCase
|
||||||
from .testcases import get_links
|
from .testcases import get_links
|
||||||
from .testcases import no_cluster
|
from .testcases import no_cluster
|
||||||
@ -42,8 +43,8 @@ class BasicProjectTest(ProjectTestCase):
|
|||||||
super(BasicProjectTest, self).setUp()
|
super(BasicProjectTest, self).setUp()
|
||||||
|
|
||||||
self.cfg = {
|
self.cfg = {
|
||||||
'db': {'image': 'busybox:latest', 'command': 'top'},
|
'db': {'image': BUSYBOX_IMAGE_WITH_TAG, 'command': 'top'},
|
||||||
'web': {'image': 'busybox:latest', 'command': 'top'},
|
'web': {'image': BUSYBOX_IMAGE_WITH_TAG, 'command': 'top'},
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_no_change(self):
|
def test_no_change(self):
|
||||||
@ -99,16 +100,16 @@ class ProjectWithDependenciesTest(ProjectTestCase):
|
|||||||
|
|
||||||
self.cfg = {
|
self.cfg = {
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
'links': ['db'],
|
'links': ['db'],
|
||||||
},
|
},
|
||||||
'nginx': {
|
'nginx': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
'links': ['web'],
|
'links': ['web'],
|
||||||
},
|
},
|
||||||
@ -173,7 +174,7 @@ class ProjectWithDependenciesTest(ProjectTestCase):
|
|||||||
def test_service_removed_while_down(self):
|
def test_service_removed_while_down(self):
|
||||||
next_cfg = {
|
next_cfg = {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
},
|
},
|
||||||
'nginx': self.cfg['nginx'],
|
'nginx': self.cfg['nginx'],
|
||||||
@ -219,16 +220,16 @@ class ProjectWithDependsOnDependenciesTest(ProjectTestCase):
|
|||||||
'version': '2',
|
'version': '2',
|
||||||
'services': {
|
'services': {
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
},
|
},
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
'depends_on': ['db'],
|
'depends_on': ['db'],
|
||||||
},
|
},
|
||||||
'nginx': {
|
'nginx': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'tail -f /dev/null',
|
'command': 'tail -f /dev/null',
|
||||||
'depends_on': ['web'],
|
'depends_on': ['web'],
|
||||||
},
|
},
|
||||||
@ -385,7 +386,7 @@ class ServiceStateTest(DockerClientTestCase):
|
|||||||
assert ('recreate', [container]) == web.convergence_plan()
|
assert ('recreate', [container]) == web.convergence_plan()
|
||||||
|
|
||||||
def test_trigger_recreate_with_nonexistent_image_tag(self):
|
def test_trigger_recreate_with_nonexistent_image_tag(self):
|
||||||
web = self.create_service('web', image="busybox:latest")
|
web = self.create_service('web', image=BUSYBOX_IMAGE_WITH_TAG)
|
||||||
container = web.create_container()
|
container = web.create_container()
|
||||||
|
|
||||||
web = self.create_service('web', image="nonexistent-image")
|
web = self.create_service('web', image="nonexistent-image")
|
||||||
|
@ -9,6 +9,7 @@ from docker.errors import APIError
|
|||||||
from docker.utils import version_lt
|
from docker.utils import version_lt
|
||||||
|
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from compose.cli.docker_client import docker_client
|
from compose.cli.docker_client import docker_client
|
||||||
from compose.config.config import resolve_environment
|
from compose.config.config import resolve_environment
|
||||||
from compose.config.environment import Environment
|
from compose.config.environment import Environment
|
||||||
@ -32,7 +33,7 @@ SWARM_ASSUME_MULTINODE = os.environ.get('SWARM_ASSUME_MULTINODE', '0') != '0'
|
|||||||
|
|
||||||
|
|
||||||
def pull_busybox(client):
|
def pull_busybox(client):
|
||||||
client.pull('busybox:latest', stream=False)
|
client.pull(BUSYBOX_IMAGE_WITH_TAG, stream=False)
|
||||||
|
|
||||||
|
|
||||||
def get_links(container):
|
def get_links(container):
|
||||||
@ -123,7 +124,7 @@ class DockerClientTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def create_service(self, name, **kwargs):
|
def create_service(self, name, **kwargs):
|
||||||
if 'image' not in kwargs and 'build' not in kwargs:
|
if 'image' not in kwargs and 'build' not in kwargs:
|
||||||
kwargs['image'] = 'busybox:latest'
|
kwargs['image'] = BUSYBOX_IMAGE_WITH_TAG
|
||||||
|
|
||||||
if 'command' not in kwargs:
|
if 'command' not in kwargs:
|
||||||
kwargs['command'] = ["top"]
|
kwargs['command'] = ["top"]
|
||||||
|
@ -15,6 +15,7 @@ import pytest
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from ...helpers import build_config_details
|
from ...helpers import build_config_details
|
||||||
|
from ...helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from compose.config import config
|
from compose.config import config
|
||||||
from compose.config import types
|
from compose.config import types
|
||||||
from compose.config.config import resolve_build_args
|
from compose.config.config import resolve_build_args
|
||||||
@ -343,7 +344,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
with pytest.raises(ConfigurationError):
|
with pytest.raises(ConfigurationError):
|
||||||
config.load(
|
config.load(
|
||||||
build_config_details(
|
build_config_details(
|
||||||
{'web': 'busybox:latest'},
|
{'web': BUSYBOX_IMAGE_WITH_TAG},
|
||||||
'working_dir',
|
'working_dir',
|
||||||
'filename.yml'
|
'filename.yml'
|
||||||
)
|
)
|
||||||
@ -353,7 +354,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
with pytest.raises(ConfigurationError):
|
with pytest.raises(ConfigurationError):
|
||||||
config.load(
|
config.load(
|
||||||
build_config_details(
|
build_config_details(
|
||||||
{'version': '2', 'services': {'web': 'busybox:latest'}},
|
{'version': '2', 'services': {'web': BUSYBOX_IMAGE_WITH_TAG}},
|
||||||
'working_dir',
|
'working_dir',
|
||||||
'filename.yml'
|
'filename.yml'
|
||||||
)
|
)
|
||||||
@ -364,7 +365,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
config.load(
|
config.load(
|
||||||
build_config_details({
|
build_config_details({
|
||||||
'version': '2',
|
'version': '2',
|
||||||
'services': {'web': 'busybox:latest'},
|
'services': {'web': BUSYBOX_IMAGE_WITH_TAG},
|
||||||
'networks': {
|
'networks': {
|
||||||
'invalid': {'foo', 'bar'}
|
'invalid': {'foo', 'bar'}
|
||||||
}
|
}
|
||||||
@ -847,15 +848,15 @@ class ConfigTest(unittest.TestCase):
|
|||||||
def test_load_sorts_in_dependency_order(self):
|
def test_load_sorts_in_dependency_order(self):
|
||||||
config_details = build_config_details({
|
config_details = build_config_details({
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'links': ['db'],
|
'links': ['db'],
|
||||||
},
|
},
|
||||||
'db': {
|
'db': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': ['volume:ro']
|
'volumes_from': ['volume:ro']
|
||||||
},
|
},
|
||||||
'volume': {
|
'volume': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': ['/tmp'],
|
'volumes': ['/tmp'],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1280,7 +1281,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'version': '2',
|
'version': '2',
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': ['data0028:/data:ro'],
|
'volumes': ['data0028:/data:ro'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1296,7 +1297,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'version': '2',
|
'version': '2',
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': ['./data0028:/data:ro'],
|
'volumes': ['./data0028:/data:ro'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1312,7 +1313,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'base.yaml',
|
'base.yaml',
|
||||||
{
|
{
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': ['data0028:/data:ro'],
|
'volumes': ['data0028:/data:ro'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -1329,7 +1330,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'version': '2.3',
|
'version': '2.3',
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': [
|
'volumes': [
|
||||||
{
|
{
|
||||||
'target': '/anonymous', 'type': 'volume'
|
'target': '/anonymous', 'type': 'volume'
|
||||||
@ -1374,7 +1375,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'version': '3.4',
|
'version': '3.4',
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': [
|
'volumes': [
|
||||||
{'type': 'bind', 'source': './web', 'target': '/web'},
|
{'type': 'bind', 'source': './web', 'target': '/web'},
|
||||||
],
|
],
|
||||||
@ -1396,7 +1397,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
'version': '3.4',
|
'version': '3.4',
|
||||||
'services': {
|
'services': {
|
||||||
'web': {
|
'web': {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes': [
|
'volumes': [
|
||||||
{'type': 'bind', 'source': '~/web', 'target': '/web'},
|
{'type': 'bind', 'source': '~/web', 'target': '/web'},
|
||||||
],
|
],
|
||||||
@ -2293,7 +2294,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_merge_mixed_ports(self):
|
def test_merge_mixed_ports(self):
|
||||||
base = {
|
base = {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'ports': [
|
'ports': [
|
||||||
{
|
{
|
||||||
@ -2310,7 +2311,7 @@ class ConfigTest(unittest.TestCase):
|
|||||||
|
|
||||||
actual = config.merge_service_dicts(base, override, V3_1)
|
actual = config.merge_service_dicts(base, override, V3_1)
|
||||||
assert actual == {
|
assert actual == {
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'command': 'top',
|
'command': 'top',
|
||||||
'ports': [types.ServicePort('1245', '1245', 'udp', None, None)]
|
'ports': [types.ServicePort('1245', '1245', 'udp', None, None)]
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import docker
|
|||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from compose.const import LABEL_ONE_OFF
|
from compose.const import LABEL_ONE_OFF
|
||||||
from compose.const import LABEL_SLUG
|
from compose.const import LABEL_SLUG
|
||||||
from compose.container import Container
|
from compose.container import Container
|
||||||
@ -17,7 +18,7 @@ class ContainerTest(unittest.TestCase):
|
|||||||
self.container_id = "abcabcabcbabc12345"
|
self.container_id = "abcabcabcbabc12345"
|
||||||
self.container_dict = {
|
self.container_dict = {
|
||||||
"Id": self.container_id,
|
"Id": self.container_id,
|
||||||
"Image": "busybox:latest",
|
"Image": BUSYBOX_IMAGE_WITH_TAG,
|
||||||
"Command": "top",
|
"Command": "top",
|
||||||
"Created": 1387384730,
|
"Created": 1387384730,
|
||||||
"Status": "Up 8 seconds",
|
"Status": "Up 8 seconds",
|
||||||
@ -43,7 +44,7 @@ class ContainerTest(unittest.TestCase):
|
|||||||
has_been_inspected=True)
|
has_been_inspected=True)
|
||||||
assert container.dictionary == {
|
assert container.dictionary == {
|
||||||
"Id": self.container_id,
|
"Id": self.container_id,
|
||||||
"Image": "busybox:latest",
|
"Image": BUSYBOX_IMAGE_WITH_TAG,
|
||||||
"Name": "/composetest_db_1",
|
"Name": "/composetest_db_1",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ class ContainerTest(unittest.TestCase):
|
|||||||
has_been_inspected=True)
|
has_been_inspected=True)
|
||||||
assert container.dictionary == {
|
assert container.dictionary == {
|
||||||
"Id": self.container_id,
|
"Id": self.container_id,
|
||||||
"Image": "busybox:latest",
|
"Image": BUSYBOX_IMAGE_WITH_TAG,
|
||||||
"Name": "/composetest_db_1",
|
"Name": "/composetest_db_1",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ from docker.errors import NotFound
|
|||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
||||||
from compose.config.config import Config
|
from compose.config.config import Config
|
||||||
from compose.config.types import VolumeFromSpec
|
from compose.config.types import VolumeFromSpec
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
@ -39,11 +40,11 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'db',
|
'name': 'db',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
networks=None,
|
networks=None,
|
||||||
@ -58,9 +59,9 @@ class ProjectTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
assert len(project.services) == 2
|
assert len(project.services) == 2
|
||||||
assert project.get_service('web').name == 'web'
|
assert project.get_service('web').name == 'web'
|
||||||
assert project.get_service('web').options['image'] == 'busybox:latest'
|
assert project.get_service('web').options['image'] == BUSYBOX_IMAGE_WITH_TAG
|
||||||
assert project.get_service('db').name == 'db'
|
assert project.get_service('db').name == 'db'
|
||||||
assert project.get_service('db').options['image'] == 'busybox:latest'
|
assert project.get_service('db').options['image'] == BUSYBOX_IMAGE_WITH_TAG
|
||||||
assert not project.networks.use_networking
|
assert not project.networks.use_networking
|
||||||
|
|
||||||
@mock.patch('compose.network.Network.true_name', lambda n: n.full_name)
|
@mock.patch('compose.network.Network.true_name', lambda n: n.full_name)
|
||||||
@ -70,11 +71,11 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'db',
|
'name': 'db',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
networks=None,
|
networks=None,
|
||||||
@ -91,7 +92,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
project='composetest',
|
project='composetest',
|
||||||
name='web',
|
name='web',
|
||||||
client=None,
|
client=None,
|
||||||
image="busybox:latest",
|
image=BUSYBOX_IMAGE_WITH_TAG,
|
||||||
)
|
)
|
||||||
project = Project('test', [web], None)
|
project = Project('test', [web], None)
|
||||||
assert project.get_service('web') == web
|
assert project.get_service('web') == web
|
||||||
@ -176,7 +177,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': [VolumeFromSpec('aaa', 'rw', 'container')]
|
'volumes_from': [VolumeFromSpec('aaa', 'rw', 'container')]
|
||||||
}],
|
}],
|
||||||
networks=None,
|
networks=None,
|
||||||
@ -194,7 +195,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
"Name": container_name,
|
"Name": container_name,
|
||||||
"Names": [container_name],
|
"Names": [container_name],
|
||||||
"Id": container_name,
|
"Id": container_name,
|
||||||
"Image": 'busybox:latest'
|
"Image": BUSYBOX_IMAGE_WITH_TAG
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
@ -205,11 +206,11 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'vol',
|
'name': 'vol',
|
||||||
'image': 'busybox:latest'
|
'image': BUSYBOX_IMAGE_WITH_TAG
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': [VolumeFromSpec('vol', 'rw', 'service')]
|
'volumes_from': [VolumeFromSpec('vol', 'rw', 'service')]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -233,11 +234,11 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'vol',
|
'name': 'vol',
|
||||||
'image': 'busybox:latest'
|
'image': BUSYBOX_IMAGE_WITH_TAG
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'volumes_from': [VolumeFromSpec('vol', 'rw', 'service')]
|
'volumes_from': [VolumeFromSpec('vol', 'rw', 'service')]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -543,7 +544,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
networks=None,
|
networks=None,
|
||||||
@ -568,7 +569,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'network_mode': 'container:aaa'
|
'network_mode': 'container:aaa'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -588,7 +589,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
"Name": container_name,
|
"Name": container_name,
|
||||||
"Names": [container_name],
|
"Names": [container_name],
|
||||||
"Id": container_name,
|
"Id": container_name,
|
||||||
"Image": 'busybox:latest'
|
"Image": BUSYBOX_IMAGE_WITH_TAG
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
@ -599,11 +600,11 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'aaa',
|
'name': 'aaa',
|
||||||
'image': 'busybox:latest'
|
'image': BUSYBOX_IMAGE_WITH_TAG
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'network_mode': 'service:aaa'
|
'network_mode': 'service:aaa'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -626,7 +627,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'foo',
|
'name': 'foo',
|
||||||
'image': 'busybox:latest'
|
'image': BUSYBOX_IMAGE_WITH_TAG
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
networks=None,
|
networks=None,
|
||||||
@ -647,7 +648,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
services=[
|
services=[
|
||||||
{
|
{
|
||||||
'name': 'foo',
|
'name': 'foo',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
'networks': {'custom': None}
|
'networks': {'custom': None}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -662,9 +663,9 @@ class ProjectTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_container_without_name(self):
|
def test_container_without_name(self):
|
||||||
self.mock_client.containers.return_value = [
|
self.mock_client.containers.return_value = [
|
||||||
{'Image': 'busybox:latest', 'Id': '1', 'Name': '1'},
|
{'Image': BUSYBOX_IMAGE_WITH_TAG, 'Id': '1', 'Name': '1'},
|
||||||
{'Image': 'busybox:latest', 'Id': '2', 'Name': None},
|
{'Image': BUSYBOX_IMAGE_WITH_TAG, 'Id': '2', 'Name': None},
|
||||||
{'Image': 'busybox:latest', 'Id': '3'},
|
{'Image': BUSYBOX_IMAGE_WITH_TAG, 'Id': '3'},
|
||||||
]
|
]
|
||||||
self.mock_client.inspect_container.return_value = {
|
self.mock_client.inspect_container.return_value = {
|
||||||
'Id': '1',
|
'Id': '1',
|
||||||
@ -681,7 +682,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
}],
|
}],
|
||||||
networks=None,
|
networks=None,
|
||||||
volumes=None,
|
volumes=None,
|
||||||
@ -699,7 +700,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
}],
|
}],
|
||||||
networks={'default': {}},
|
networks={'default': {}},
|
||||||
volumes={'data': {}},
|
volumes={'data': {}},
|
||||||
@ -711,7 +712,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
self.mock_client.remove_volume.side_effect = NotFound(None, None, 'oops')
|
self.mock_client.remove_volume.side_effect = NotFound(None, None, 'oops')
|
||||||
|
|
||||||
project.down(ImageType.all, True)
|
project.down(ImageType.all, True)
|
||||||
self.mock_client.remove_image.assert_called_once_with("busybox:latest")
|
self.mock_client.remove_image.assert_called_once_with(BUSYBOX_IMAGE_WITH_TAG)
|
||||||
|
|
||||||
def test_no_warning_on_stop(self):
|
def test_no_warning_on_stop(self):
|
||||||
self.mock_client.info.return_value = {'Swarm': {'LocalNodeState': 'active'}}
|
self.mock_client.info.return_value = {'Swarm': {'LocalNodeState': 'active'}}
|
||||||
@ -744,7 +745,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
def test_project_platform_value(self):
|
def test_project_platform_value(self):
|
||||||
service_config = {
|
service_config = {
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
}
|
}
|
||||||
config_data = Config(
|
config_data = Config(
|
||||||
version=V2_4, services=[service_config], networks={}, volumes={}, secrets=None, configs=None
|
version=V2_4, services=[service_config], networks={}, volumes={}, secrets=None, configs=None
|
||||||
@ -771,8 +772,8 @@ class ProjectTest(unittest.TestCase):
|
|||||||
config_data = Config(
|
config_data = Config(
|
||||||
version=V3_7,
|
version=V3_7,
|
||||||
services=[
|
services=[
|
||||||
{'name': 'web', 'image': 'busybox:latest'},
|
{'name': 'web', 'image': BUSYBOX_IMAGE_WITH_TAG},
|
||||||
{'name': 'db', 'image': 'busybox:latest', 'stop_grace_period': '1s'},
|
{'name': 'db', 'image': BUSYBOX_IMAGE_WITH_TAG, 'stop_grace_period': '1s'},
|
||||||
],
|
],
|
||||||
networks={}, volumes={}, secrets=None, configs=None,
|
networks={}, volumes={}, secrets=None, configs=None,
|
||||||
)
|
)
|
||||||
@ -804,7 +805,7 @@ class ProjectTest(unittest.TestCase):
|
|||||||
version=V2_0,
|
version=V2_0,
|
||||||
services=[{
|
services=[{
|
||||||
'name': 'web',
|
'name': 'web',
|
||||||
'image': 'busybox:latest',
|
'image': BUSYBOX_IMAGE_WITH_TAG,
|
||||||
}],
|
}],
|
||||||
networks=None,
|
networks=None,
|
||||||
volumes=None,
|
volumes=None,
|
||||||
|
@ -828,7 +828,7 @@ class ServiceTest(unittest.TestCase):
|
|||||||
assert service.specifies_host_port()
|
assert service.specifies_host_port()
|
||||||
|
|
||||||
def test_image_name_from_config(self):
|
def test_image_name_from_config(self):
|
||||||
image_name = 'example/web:latest'
|
image_name = 'example/web:mytag'
|
||||||
service = Service('foo', image=image_name)
|
service = Service('foo', image=image_name)
|
||||||
assert service.image_name == image_name
|
assert service.image_name == image_name
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user