Skip to content

Commit

Permalink
GenericResources was introduced in 1.32
Browse files Browse the repository at this point in the history
Signed-off-by: Joffrey F <joffrey@docker.com>
  • Loading branch information
shin- committed Feb 21, 2018
1 parent f40079d commit 8fd9d3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docker/api/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def raise_version_error(param, min_version):
raise_version_error('ContainerSpec.isolation', '1.35')

if task_template.get('Resources'):
if utils.version_lt(version, '1.35'):
if utils.version_lt(version, '1.32'):
if task_template['Resources'].get('GenericResources'):
raise_version_error('Resources.generic_resources', '1.35')
raise_version_error('Resources.generic_resources', '1.32')


def _merge_task_template(current, override):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/api_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _create_service_with_generic_resources(self, generic_resources):
svc_id = self.client.create_service(task_tmpl, name=name)
return resources, self.client.inspect_service(svc_id)

@requires_api_version('1.35')
@requires_api_version('1.32')
def test_create_service_with_generic_resources(self):
successful = [{
'input': [
Expand Down Expand Up @@ -258,6 +258,7 @@ def _key(d, specs=('DiscreteResourceSpec', 'NamedResourceSpec')):
expected = test.get('expected', test['input'])
assert sorted(actual, key=_key) == sorted(expected, key=_key)

@requires_api_version('1.32')
def test_create_service_with_invalid_generic_resources(self):
for test_input in ['1', 1.0, lambda: '1', {1, 2}]:
with pytest.raises(docker.errors.InvalidArgument):
Expand Down

0 comments on commit 8fd9d3c

Please sign in to comment.