* Update default API version to v1.39
When running the docker-py integration tests in the Moby repository, some
tests were skipped because the API version used was too low:
SKIPPED [1] tests/integration/api_service_test.py:882: API version is too low (< 1.38)
SKIPPED [1] tests/integration/api_swarm_test.py:59: API version is too low (< 1.39)
SKIPPED [1] tests/integration/api_swarm_test.py:38: API version is too low (< 1.39)
SKIPPED [1] tests/integration/api_swarm_test.py:45: API version is too low (< 1.39)
SKIPPED [1] tests/integration/api_swarm_test.py:52: API version is too low (< 1.39)
While it's possible to override the API version to use for testing
using the `DOCKER_TEST_API_VERSION` environment variable, we may want
to set the default to a version that supports all features that were
added.
This patch updates the default API version to v1.39, which is the minimum
version required for those features, and corresponds with Docker 18.09.
Note that the API version of the current (19.03) Docker release is v1.40,
but using that version as default would exclude users that did not update
their Docker version yet (and would not be needed yet for the features provided).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Makefile: set DOCKER_TEST_API_VERSION to v1.39
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This test was updated in 7d92fbdee1, but
omitted the "error" prefix in the message, causing the test to fail;
_________ CreateContainerTest.test_invalid_log_driver_raises_exception _________
tests/integration/api_container_test.py:293: in test_invalid_log_driver_raises_exception
assert excinfo.value.explanation in expected_msgs
E AssertionError: assert 'error looking up logging plugin asdf: plugin "asdf" not found' in ["logger: no log driver named 'asdf' is registered", 'looking up logging plugin asdf: plugin "asdf" not found']
E + where 'error looking up logging plugin asdf: plugin "asdf" not found' = APIError(HTTPError('400 Client Error: Bad Request for url: http+docker://localhost/v1.39/containers/create')).explanation
E + where APIError(HTTPError('400 Client Error: Bad Request for url: http+docker://localhost/v1.39/containers/create')) = <ExceptionInfo APIError tblen=6>.value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Docker API 1.32 added support for providing options to a network driver
via EndpointConfig when connecting a container to a network.
Signed-off-by: Mike Haboustak <haboustak@gmail.com>
Make sure we use the LTS nodes, to prevent using machines that
we prepared with cgroups v2 (which is not yet supported by docker v19.03)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This replaces the custom dockerswarm/dind image with the official
dind images, which should provide the same functionality.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The ImageCollectionTest.test_pull_multiple test performs a `docker pull` without
a `:tag` specified) to pull all tags of the given repository (image).
After pulling the image, the image(s) pulled are checked to verify if the list
of images contains the `:latest` tag.
However, the test assumes that all tags of the image are tags for the same
version of the image (same digest), and thus a *single* image is returned, which
is not always the case.
Currently, the `hello-world:latest` and `hello-world:linux` tags point to a
different digest, therefore the `client.images.pull()` returns multiple images:
one image for digest, making the test fail:
=================================== FAILURES ===================================
____________________ ImageCollectionTest.test_pull_multiple ____________________
tests/integration/models_images_test.py:90: in test_pull_multiple
assert len(images) == 1
E AssertionError: assert 2 == 1
E + where 2 = len([<Image: 'hello-world:linux'>, <Image: 'hello-world:latest'>])
This patch updates the test to not assume a single image is returned, and instead
loop through the list of images and check if any of the images contains the
`:latest` tag.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Pytest 4.3.1 includes the fix from
https://github.com/pytest-dev/pytest/pull/4795
which should fix the following failure:
> INFO: Building docker-sdk-python3:4.0.2...
> sha256:c7a40413c985b6e75df324fae39b1c30cb78a25df71b7892f1a4a15449537fb3
> INFO: Starting docker-py tests...
> Traceback (most recent call last):
> File "/usr/local/bin/pytest", line 10, in <module>
> sys.exit(main())
> File "/usr/local/lib/python3.6/site-packages/_pytest/config/__init__.py", line 61, in main
> config = _prepareconfig(args, plugins)
> File "/usr/local/lib/python3.6/site-packages/_pytest/config/__init__.py", line 182, in _prepareconfig
> config = get_config()
> File "/usr/local/lib/python3.6/site-packages/_pytest/config/__init__.py", line 156, in get_config
> pluginmanager.import_plugin(spec)
> File "/usr/local/lib/python3.6/site-packages/_pytest/config/__init__.py", line 530, in import_plugin
> __import__(importspec)
> File "/usr/local/lib/python3.6/site-packages/_pytest/tmpdir.py", line 25, in <module>
> class TempPathFactory(object):
> File "/usr/local/lib/python3.6/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory
> lambda p: Path(os.path.abspath(six.text_type(p)))
> TypeError: attrib() got an unexpected keyword argument 'convert'
> Sending interrupt signal to process
> Terminated
> script returned exit code 143
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The BUSYBOX variable was renamed to TEST_IMG in
54b48a9b7a, however
0ddf428b6c got merged
after that change, but was out of date, and therefore
caused the tests to fail:
```
=================================== FAILURES ===================================
________ ServiceTest.test_create_service_with_network_attachment_config ________
tests/integration/api_service_test.py:379: in test_create_service_with_network_attachment_config
container_spec = docker.types.ContainerSpec(BUSYBOX, ['true'])
E NameError: global name 'BUSYBOX' is not defined
```
Fix the test by using the correct variable name.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>