mirror of https://github.com/docker/docker-py.git
Merge pull request #1599 from docker/test_17.05_engine
Adjust tests and add newest engine version to Jenkinsfile
This commit is contained in:
commit
007ab677a1
|
@ -7,7 +7,7 @@ def images = [:]
|
|||
|
||||
// Note: Swarm in dind seem notoriously flimsy with 1.12.1+, which is why we're
|
||||
// sticking with 1.12.0 for the 1.12 series
|
||||
def dockerVersions = ["1.12.0", "1.13.1", "17.04.0-ce-rc1"]
|
||||
def dockerVersions = ["1.12.0", "1.13.1", "17.04.0-ce", "17.05.0-ce"]
|
||||
|
||||
def buildImage = { name, buildargs, pyTag ->
|
||||
img = docker.image(name)
|
||||
|
@ -35,7 +35,7 @@ def buildImages = { ->
|
|||
}
|
||||
|
||||
def getAPIVersion = { engineVersion ->
|
||||
def versionMap = ['1.12.': '1.24', '1.13.': '1.26', '17.04': '1.27']
|
||||
def versionMap = ['1.12.': '1.24', '1.13.': '1.26', '17.04': '1.27', '17.05': '1.29']
|
||||
return versionMap[engineVersion.substring(0, 5)]
|
||||
}
|
||||
|
||||
|
|
4
Makefile
4
Makefile
|
@ -41,8 +41,8 @@ integration-test: build
|
|||
integration-test-py3: build-py3
|
||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 py.test tests/integration/${file}
|
||||
|
||||
TEST_API_VERSION ?= 1.27
|
||||
TEST_ENGINE_VERSION ?= 17.04.0-ce-rc1
|
||||
TEST_API_VERSION ?= 1.29
|
||||
TEST_ENGINE_VERSION ?= 17.05.0-ce
|
||||
|
||||
.PHONY: integration-dind
|
||||
integration-dind: build build-py3
|
||||
|
|
|
@ -54,14 +54,24 @@ def requires_api_version(version):
|
|||
)
|
||||
|
||||
|
||||
def requires_experimental(f):
|
||||
def requires_experimental(until=None):
|
||||
test_version = os.environ.get(
|
||||
'DOCKER_TEST_API_VERSION', docker.constants.DEFAULT_DOCKER_API_VERSION
|
||||
)
|
||||
|
||||
def req_exp(f):
|
||||
@functools.wraps(f)
|
||||
def wrapped(self, *args, **kwargs):
|
||||
if not self.client.info()['ExperimentalBuild']:
|
||||
pytest.skip('Feature requires Docker Engine experimental mode')
|
||||
return f(self, *args, **kwargs)
|
||||
|
||||
if until and docker.utils.version_gte(test_version, until):
|
||||
return f
|
||||
return wrapped
|
||||
|
||||
return req_exp
|
||||
|
||||
|
||||
def wait_on_condition(condition, delay=0.1, timeout=40):
|
||||
start_time = time.time()
|
||||
|
|
|
@ -103,18 +103,28 @@ class ServiceTest(BaseAPIIntegrationTest):
|
|||
assert services[0]['ID'] == svc_id['ID']
|
||||
|
||||
@requires_api_version('1.25')
|
||||
@requires_experimental
|
||||
@requires_experimental(until='1.29')
|
||||
def test_service_logs(self):
|
||||
name, svc_id = self.create_simple_service()
|
||||
assert self.get_service_container(name, include_stopped=True)
|
||||
attempts = 20
|
||||
while True:
|
||||
if attempts == 0:
|
||||
self.fail('No service logs produced by endpoint')
|
||||
return
|
||||
logs = self.client.service_logs(svc_id, stdout=True, is_tty=False)
|
||||
try:
|
||||
log_line = next(logs)
|
||||
except StopIteration:
|
||||
attempts -= 1
|
||||
time.sleep(0.1)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
if six.PY3:
|
||||
log_line = log_line.decode('utf-8')
|
||||
assert 'hello\n' in log_line
|
||||
assert 'com.docker.swarm.service.id={}'.format(
|
||||
svc_id['ID']
|
||||
) in log_line
|
||||
|
||||
def test_create_service_custom_log_driver(self):
|
||||
container_spec = docker.types.ContainerSpec(
|
||||
|
|
Loading…
Reference in New Issue