Compare commits

...

9 Commits
py2 ... 1.15.0

Author SHA1 Message Date
Joffrey F
e12f3b9465 Bump 1.15.0
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-07-25 16:19:49 -07:00
Kirin Rastogi
daa6ae69f2 Add exclusion for networkname
Signed-off-by: Kirin Rastogi <kirin.Rastogi@avg.com>
Signed-off-by: Kirin Rastogi <rastogikirin@gmail.com>
2017-07-25 16:05:07 -07:00
Joffrey F
046d12fb33 Scripts build and push compose-tests image
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-07-25 16:05:07 -07:00
Joffrey F
34db8cc9e8 Some more test adjustments for Swarm support
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-07-25 16:05:07 -07:00
Evan Shaw
d2a1c3128c Always silence pull output with --parallel
This is how things were prior to the addition of the --quiet flag.
Making it not silent produces output that's weird and difficult to read.

Signed-off-by: Evan Shaw <evan@vendhq.com>
2017-07-25 16:05:04 -07:00
NikitaVlaznev
d8316704dd Fix double silent argument value
Fix for "TypeError: pull() got multiple values for keyword argument 'silent'."
This change e9b6cc23fc caused additional value to be passed for the 'silent' argument, that was already passed there: f85da99ef3

Signed-off-by: Nikita Vlaznev <nikita.dto@gmail.com>
2017-07-25 16:05:00 -07:00
Joel Barciauskas
27f48f6481 Add --quiet parameter to docker-compose pull, using existing silent flag
Signed-off-by: Joel Barciauskas <barciajo@gmail.com>
2017-07-25 16:04:53 -07:00
Alexey Rokhin
b4bec63ea8 service_test.py reorder imports
Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
2017-07-25 16:04:53 -07:00
Alexey Rokhin
f4824416a4 skip cpu_percent test for Linux
Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
2017-07-25 16:04:53 -07:00
16 changed files with 114 additions and 58 deletions

View File

@@ -7,3 +7,5 @@ coverage-html
docs/_site
venv
.tox
**/__pycache__
*.pyc

View File

@@ -1,7 +1,7 @@
Change log
==========
1.15.0 (2017-07-18)
1.15.0 (2017-07-26)
-------------------
### New features
@@ -45,6 +45,9 @@ Change log
- Fixed an issue where the output of `docker-compose config` would be invalid
if the original file used `Y` or `N` values
- Fixed an issue preventing `up` operations on a previously created stack on
Windows Engine.
1.14.0 (2017-06-19)
-------------------

View File

@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = '1.15.0-rc1'
__version__ = '1.15.0'

View File

@@ -18,7 +18,8 @@ log = logging.getLogger(__name__)
OPTS_EXCEPTIONS = [
'com.docker.network.driver.overlay.vxlanid_list',
'com.docker.network.windowsshim.hnsid'
'com.docker.network.windowsshim.hnsid',
'com.docker.network.windowsshim.networkname'
]

17
script/build/test-image Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
if [ -z "$1" ]; then
>&2 echo "First argument must be image tag."
exit 1
fi
TAG=$1
docker build -t docker-compose-tests:tmp .
ctnr_id=$(docker create --entrypoint=tox docker-compose-tests:tmp)
docker commit $ctnr_id docker/compose-tests:latest
docker tag docker/compose-tests:latest docker/compose-tests:$TAG
docker rm -f $ctnr_id
docker rmi -f docker-compose-tests:tmp

View File

@@ -27,6 +27,9 @@ script/build/linux
echo "Building the container distribution"
script/build/image $VERSION
echo "Building the compose-tests image"
script/build/test-image $VERSION
echo "Create a github release"
# TODO: script more of this https://developer.github.com/v3/repos/releases/
browser https://github.com/$REPO/releases/new

View File

@@ -54,6 +54,10 @@ git push $GITHUB_REPO $VERSION
echo "Uploading the docker image"
docker push docker/compose:$VERSION
echo "Uploading the compose-tests image"
docker push docker/compose-tests:latest
docker push docker/compose-tests:$VERSION
echo "Uploading package to PyPI"
pandoc -f markdown -t rst README.md -o README.rst
sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/master\/logo.png?raw=true/' README.rst

View File

@@ -15,7 +15,7 @@
set -e
VERSION="1.15.0-rc1"
VERSION="1.15.0"
IMAGE="docker/compose:$VERSION"

View File

@@ -20,8 +20,6 @@ from docker import errors
from .. import mock
from ..helpers import create_host_file
from ..helpers import is_cluster
from ..helpers import no_cluster
from compose.cli.command import get_project
from compose.config.errors import DuplicateOverrideFileFound
from compose.container import Container
@@ -29,6 +27,8 @@ from compose.project import OneOffFilter
from compose.utils import nanoseconds_from_time_seconds
from tests.integration.testcases import DockerClientTestCase
from tests.integration.testcases import get_links
from tests.integration.testcases import is_cluster
from tests.integration.testcases import no_cluster
from tests.integration.testcases import pull_busybox
from tests.integration.testcases import SWARM_SKIP_RM_VOLUMES
from tests.integration.testcases import v2_1_only
@@ -116,7 +116,7 @@ class CLITestCase(DockerClientTestCase):
def tearDown(self):
if self.base_dir:
self.project.kill()
self.project.remove_stopped()
self.project.down(None, True)
for container in self.project.containers(stopped=True, one_off=OneOffFilter.only):
container.remove(force=True)
@@ -1214,6 +1214,7 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(proc.returncode, 1)
@v2_only()
@no_cluster('Container PID mode does not work across clusters')
def test_up_with_pid_mode(self):
c = self.client.create_container(
'busybox', 'top', name='composetest_pid_mode_container',
@@ -1244,8 +1245,8 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(len(self.project.containers()), 1)
stdout, stderr = self.dispatch(['exec', '-T', 'console', 'ls', '-1d', '/'])
self.assertEqual(stdout, "/\n")
self.assertEqual(stderr, "")
self.assertEqual(stdout, "/\n")
def test_exec_custom_user(self):
self.base_dir = 'tests/fixtures/links-composefile'
@@ -1826,7 +1827,13 @@ class CLITestCase(DockerClientTestCase):
result = self.dispatch(['logs', '-f'])
assert result.stdout.count('\n') == 5
if not is_cluster(self.client):
assert result.stdout.count('\n') == 5
else:
# Sometimes logs are picked up from old containers that haven't yet
# been removed (removal in Swarm is async)
assert result.stdout.count('\n') >= 5
assert 'simple' in result.stdout
assert 'another' in result.stdout
assert 'exited with code 0' in result.stdout
@@ -1882,7 +1889,10 @@ class CLITestCase(DockerClientTestCase):
self.dispatch(['up'])
result = self.dispatch(['logs', '--tail', '2'])
assert result.stdout.count('\n') == 3
assert 'c\n' in result.stdout
assert 'd\n' in result.stdout
assert 'a\n' not in result.stdout
assert 'b\n' not in result.stdout
def test_kill(self):
self.dispatch(['up', '-d'], None)
@@ -2045,8 +2055,8 @@ class CLITestCase(DockerClientTestCase):
return result.stdout.rstrip()
assert get_port(3000) == container.get_local_port(3000)
assert ':49152' in get_port(3001)
assert ':49153' in get_port(3002)
assert ':53222' in get_port(3001)
assert ':53223' in get_port(3002)
def test_port_with_scale(self):
self.base_dir = 'tests/fixtures/ports-composefile-scale'

View File

@@ -6,10 +6,10 @@ services:
ports:
- target: 3000
- target: 3001
published: 49152
published: 53222
- target: 3002
published: 49153
published: 53223
protocol: tcp
- target: 3003
published: 49154
published: 53224
protocol: udp

View File

@@ -1,12 +1,8 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import os
from docker.errors import APIError
from pytest import skip
from compose.config.config import ConfigDetails
from compose.config.config import ConfigFile
from compose.config.config import load
@@ -48,34 +44,3 @@ def create_host_file(client, filename):
"Container exited with code {}:\n{}".format(exitcode, output))
finally:
client.remove_container(container, force=True)
def is_cluster(client):
nodes = None
def get_nodes_number():
try:
return len(client.nodes())
except APIError:
# If the Engine is not part of a Swarm, the SDK will raise
# an APIError
return 0
if nodes is None:
# Only make the API call if the value hasn't been cached yet
nodes = get_nodes_number()
return nodes > 1
def no_cluster(reason):
def decorator(f):
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
if is_cluster(self.client):
skip("Test will not be run in cluster mode: %s" % reason)
return
return f(self, *args, **kwargs)
return wrapper
return decorator

View File

@@ -12,8 +12,6 @@ from docker.errors import NotFound
from .. import mock
from ..helpers import build_config as load_config
from ..helpers import create_host_file
from ..helpers import is_cluster
from ..helpers import no_cluster
from .testcases import DockerClientTestCase
from .testcases import SWARM_SKIP_CONTAINERS_ALL
from compose.config import config
@@ -33,6 +31,8 @@ from compose.errors import NoHealthCheckConfigured
from compose.project import Project
from compose.project import ProjectError
from compose.service import ConvergenceStrategy
from tests.integration.testcases import is_cluster
from tests.integration.testcases import no_cluster
from tests.integration.testcases import v2_1_only
from tests.integration.testcases import v2_2_only
from tests.integration.testcases import v2_only

View File

@@ -13,8 +13,6 @@ from six import StringIO
from six import text_type
from .. import mock
from ..helpers import is_cluster
from ..helpers import no_cluster
from .testcases import DockerClientTestCase
from .testcases import get_links
from .testcases import pull_busybox
@@ -38,6 +36,8 @@ from compose.service import ConvergenceStrategy
from compose.service import NetworkMode
from compose.service import PidMode
from compose.service import Service
from tests.integration.testcases import is_cluster
from tests.integration.testcases import no_cluster
from tests.integration.testcases import v2_1_only
from tests.integration.testcases import v2_2_only
from tests.integration.testcases import v2_only
@@ -635,7 +635,10 @@ class ServiceTest(DockerClientTestCase):
with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
f.write("FROM busybox\n")
self.create_service('web', build={'context': base_dir}).build()
service = self.create_service('web', build={'context': base_dir})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert self.client.inspect_image('composetest_web')
def test_build_non_ascii_filename(self):
@@ -648,7 +651,9 @@ class ServiceTest(DockerClientTestCase):
with open(os.path.join(base_dir.encode('utf8'), b'foo\xE2bar'), 'w') as f:
f.write("hello world\n")
self.create_service('web', build={'context': text_type(base_dir)}).build()
service = self.create_service('web', build={'context': text_type(base_dir)})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert self.client.inspect_image('composetest_web')
def test_build_with_image_name(self):
@@ -683,6 +688,7 @@ class ServiceTest(DockerClientTestCase):
build={'context': text_type(base_dir),
'args': {"build_version": "1"}})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert service.image()
assert "build_version=1" in service.image()['ContainerConfig']['Cmd']
@@ -699,6 +705,8 @@ class ServiceTest(DockerClientTestCase):
build={'context': text_type(base_dir),
'args': {"build_version": "1"}})
service.build(build_args_override={'build_version': '2'})
self.addCleanup(self.client.remove_image, service.image_name)
assert service.image()
assert "build_version=2" in service.image()['ContainerConfig']['Cmd']
@@ -714,9 +722,12 @@ class ServiceTest(DockerClientTestCase):
'labels': {'com.docker.compose.test': 'true'}
})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert service.image()
assert service.image()['Config']['Labels']['com.docker.compose.test'] == 'true'
@no_cluster('Container networks not on Swarm')
def test_build_with_network(self):
base_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, base_dir)
@@ -739,6 +750,8 @@ class ServiceTest(DockerClientTestCase):
})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert service.image()
def test_start_container_stays_unprivileged(self):
@@ -1130,6 +1143,8 @@ class ServiceTest(DockerClientTestCase):
build={'context': base_dir,
'cache_from': ['build1']})
service.build()
self.addCleanup(self.client.remove_image, service.image_name)
assert service.image()
@mock.patch.dict(os.environ)

View File

@@ -1,13 +1,14 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import os
import pytest
from docker.errors import APIError
from docker.utils import version_lt
from .. import unittest
from ..helpers import is_cluster
from compose.cli.docker_client import docker_client
from compose.config.config import resolve_environment
from compose.config.environment import Environment
@@ -26,6 +27,7 @@ from compose.service import Service
SWARM_SKIP_CONTAINERS_ALL = os.environ.get('SWARM_SKIP_CONTAINERS_ALL', '0') != '0'
SWARM_SKIP_CPU_SHARES = os.environ.get('SWARM_SKIP_CPU_SHARES', '0') != '0'
SWARM_SKIP_RM_VOLUMES = os.environ.get('SWARM_SKIP_RM_VOLUMES', '0') != '0'
SWARM_ASSUME_MULTINODE = os.environ.get('SWARM_ASSUME_MULTINODE', '0') != '0'
def pull_busybox(client):
@@ -142,3 +144,35 @@ class DockerClientTestCase(unittest.TestCase):
volumes = self.client.volumes(filters={'name': volume_name})['Volumes']
assert len(volumes) > 0
return self.client.inspect_volume(volumes[0]['Name'])
def is_cluster(client):
if SWARM_ASSUME_MULTINODE:
return True
def get_nodes_number():
try:
return len(client.nodes())
except APIError:
# If the Engine is not part of a Swarm, the SDK will raise
# an APIError
return 0
if not hasattr(is_cluster, 'nodes') or is_cluster.nodes is None:
# Only make the API call if the value hasn't been cached yet
is_cluster.nodes = get_nodes_number()
return is_cluster.nodes > 1
def no_cluster(reason):
def decorator(f):
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
if is_cluster(self.client):
pytest.skip("Test will not be run in cluster mode: %s" % reason)
return
return f(self, *args, **kwargs)
return wrapper
return decorator

View File

@@ -3,8 +3,8 @@ from __future__ import unicode_literals
from docker.errors import DockerException
from ..helpers import no_cluster
from .testcases import DockerClientTestCase
from .testcases import no_cluster
from compose.const import LABEL_PROJECT
from compose.const import LABEL_VOLUME
from compose.volume import Volume

View File

@@ -9,6 +9,8 @@ passenv =
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY
DOCKER_VERSION
SWARM_SKIP_*
SWARM_ASSUME_MULTINODE
setenv =
HOME=/tmp
deps =