Commit Graph

1016 Commits

Author SHA1 Message Date
Joffrey F 34ffc56865 Streaming TTY messages sometimes get truncated. Handle gracefully in demux tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-05-01 00:59:35 -07:00
Joffrey F 62c8bcbbb6 Increase timeout on test with long sleeps
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-05-01 00:47:16 -07:00
Joffrey F a2a2d100e8 Reorder imports
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-05-01 00:35:12 -07:00
Joffrey F 2e67cd1cc7 Improve socket_detached test helper to support future versions of the daemon
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-05-01 00:35:12 -07:00
Joffrey F 073a21c28a Separate into individual tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-05-01 00:20:40 -07:00
Joffrey F b06e437da8 Avoid demux test flakiness
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-04-30 23:47:09 -07:00
Joffrey F a823acc2ca Make dockerpycreds part of the SDK under docker.credentials
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-04-30 23:37:55 -07:00
Joffrey F 0287cd9f2e
Merge pull request #2309 from thaJeztah/remove_init_path_create
Remove init_path from create
2019-04-30 23:37:06 -07:00
Joffrey F 1aaa76dc5b
Merge pull request #2297 from hannseman/service-init
Add support for setting init on services
2019-04-14 15:07:47 -07:00
Sebastiaan van Stijn 50d475797a
Remove init_path from create
This option was never functional, and was not intended
to be added to the "container create" API, so let's
remove it, because it has been removed in Docker 17.05,
and was broken in versions before that; see

- https://github.com/moby/moby/issues/32355 --init-path does not seem to work
- https://github.com/moby/moby/pull/32470 remove --init-path from client

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 02:42:23 +02:00
Ulysses Souza ef043559c4 Add 'sleep 2' to avoid race condition on attach
Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-04-04 14:09:18 +02:00
Ulysses Souza 1b572a4340
Merge pull request #1882 from larkost/1743-container-ports
add ports to containers
2019-04-03 11:20:02 +02:00
Hannes Ljungberg 0d5aacc464 Add support for setting init on services
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-28 16:03:48 +01:00
Ulysses Souza d1f7979f24 Refactor and add tests
Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-03-26 17:28:49 +01:00
Karl Kuehn 4890864d65 add ports to containers
Signed-off-by: Karl Kuehn <kuehn.karl@gmail.com>
2019-03-26 16:55:45 +01:00
Ulysses Souza b2175c9475 Fix base_url to keep TCP protocol
This fix lets the responsability of changing the
protocol to `parse_host` afterwards, letting
`base_url` with the original value.

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-03-26 16:04:06 +01:00
Ulysses Souza 15862eacbf Xfail test_attach_stream_and_cancel on TLS
This test is quite flaky on ssl integration test

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-03-26 16:04:06 +01:00
Ian Campbell c1fea8ee4a
Merge pull request #2288 from hannseman/container-run-create-volume_driver
Move volume_driver to RUN_HOST_CONFIG_KWARGS
2019-03-25 12:24:54 +00:00
Ian Campbell d38c7246a4
Merge pull request #2287 from hannseman/swarm-default-addr-pool-redux
Redux added arguments to create a swarm with a custom address pool and subnet size.
2019-03-25 12:01:15 +00:00
Ian Campbell 5abf671442
Merge pull request #2282 from ulyssessouza/avoid-race-condition-on-autoremove
Avoid race condition on short execution
2019-03-25 12:00:28 +00:00
Ulysses Souza 8f42dd1484 Avoid race condition on short execution
- Add a sleep of 2 seconds to be sure the logs
can be requested before the daemon removes the
container when run with auto_remove=True

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-03-25 12:42:54 +01:00
Hannes Ljungberg 523371e21d Move volume_driver to RUN_HOST_CONFIG_KWARGS
Fixes #2271

Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-23 20:57:23 +01:00
Barry Shapira d6cc972cd9 Split monolithic integration tests into individual tests.
The integration tests require restarting the swarm once for each
test.  I had done so manually with self.init_swarm(force_new_cluster=True)
but that wasn't resetting the swarm state correctly.  The usual
test teardown procedure cleans up correctly.

Signed-off-by: Barry Shapira <barry@whiterabbit.ai>
2019-03-22 10:40:27 +01:00
Barry Shapira 781dc30ad4 Check API version before setting swarm addr pool.
Also corrected a documentation error: the default API version from
constants is currently 1.35, not 1.30 as was sometimes listed.

Signed-off-by: Barry Shapira <barry@whiterabbit.ai>

Removed accidental whitespace.

Signed-off-by: Barry Shapira <barry@whiterabbit.ai>
2019-03-22 10:40:27 +01:00
Barry Shapira 5d69a0a62e Added arguments to creeate a swarm with a custom address pool and subnet size.
Signed-off-by: Barry Shapira <barry@whiterabbit.ai>
2019-03-22 10:38:13 +01:00
Hannes Ljungberg 7143cf02ab Test port lookup with protocols
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-18 22:15:49 +01:00
Hannes Ljungberg 35714c46b1 Test all split_port with all valid protocols
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-18 22:15:45 +01:00
Hannes Ljungberg d429a823ed Make PlacementPreference build correct context
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-01-18 21:50:31 +01:00
Joffrey F a579e9e205 Remove use_config_proxy from exec. Add use_config_proxy docs to DockerClient
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-01-09 14:45:13 -08:00
Sebastiaan van Stijn 219c52141e
Regression 443 test: relax status-code check
This test was testing for a 500 status, but this status
is actually a bug in the API (as it's due to an invalid
request), and the API should actually return a 400 status.

To make this test handle both situations, relax the test
to accept either a 4xx or 5xx status.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-09 21:23:11 +01:00
Joffrey F 65bebc085a Style fixes and removed some unused code
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-01-09 11:30:58 -08:00
Corentin Henry 2c4a8651a8 By default, disable proxy support
This is to avoid a breaking change

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2019-01-09 11:30:58 -08:00
Corentin Henry 0d37390c46 add integration tests for proxy support
Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2019-01-09 11:30:58 -08:00
Corentin Henry 545adc2a59 add unit tests for ProxyConfig
Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2019-01-09 11:30:58 -08:00
Corentin Henry 6e227895d3 tests: remove outdated code
the _cfg attribute does not exist anymore

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2019-01-09 11:30:58 -08:00
Joffrey F 72f4f527ad Update test dependencies to latest version, fix some flake8 errors
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-01-09 11:18:40 -08:00
Joffrey F c344660f20
Merge pull request #2188 from docker/c6374-credhelpers
Modernize auth management
2018-11-30 15:32:30 -08:00
Joffrey F b2ad302636 Fix test names
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-30 14:58:18 -08:00
Joffrey F ee6ec4c6e8 Merge branch 'master' of https://github.com/little-dude/docker-py into little-dude-master 2018-11-30 14:48:19 -08:00
Joffrey F cc38efa68e Add some credHelpers tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-30 14:41:56 -08:00
Joffrey F 01ccaa6af2 Make AuthConfig a dict subclass for backward-compatibility
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-30 13:51:01 -08:00
Joffrey F bc5d7c8cb6 Modernize auth management
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-28 19:32:01 -08:00
Corentin Henry 7b3b83dfdb fix exec api inconsistency
Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-28 15:16:23 -08:00
Corentin Henry 76447d0ca3 tests various exec_create/exec_start combinations
Test the interation of the tty, demux and stream parameters

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-28 13:37:17 -08:00
Corentin Henry 6540900dae add tests for _read_from_socket
Check that the return value against the various combination of
parameters this function can take (tty, stream, and demux).

This commit also fixes a bug that the tests uncovered a bug in
consume_socket_output.

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-28 13:37:10 -08:00
Joffrey F c53423f118 Update DockerClient.images.pull to always stream response
Also raise a warning when users attempt to specify the "stream" parameter

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-28 11:27:04 -08:00
adw1n a74d546864 Fix pulling images with `stream=True`
Pulling an image with option `stream=True` like this:
```
client.api.pull('docker.io/user/repo_name', tag='latest', stream=True)
```
without consuming the generator oftentimes results in premature drop of the connection. Docker daemon tries to send progress of pulling the image to the client, but it encounters an error (broken pipe) and therefore cancells the pull action:
```
Thread 1 "dockerd-dev" received signal SIGPIPE, Broken pipe.
ERRO[2018-09-03T05:12:35.746497638+02:00] Not continuing with pull after error: context canceled
```
As described in issue #2116, even though client receives response with status code 200, image is not pulled.

Closes #2116

Signed-off-by: Przemysław Adamek <adw1n@users.noreply.github.com>
2018-11-28 11:27:04 -08:00
Corentin Henry 5f157bbaca implement stream demultiplexing for exec commands
fixes https://github.com/docker/docker-py/issues/1952

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-27 17:01:48 -08:00
Joffrey F 114630161a Correctly handle longpath prefix in process_dockerfile when joining paths
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-26 17:34:26 -08:00
Corentin Henry 47c10aa383 tests: fix failure due to pytest deprecation
Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-21 17:17:50 -08:00
Joffrey F f83fe7c959 Properly convert non-string filters to expected string format
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-08 17:22:24 -08:00
Joffrey F e237c0ea16 Add named parameter to image.save to identify which repository name to use in the resulting tarball
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-06 14:46:37 -08:00
Joffrey F f302756599 Rewrite utils.parse_host to detect more invalid addresses.
The method now uses parsing methods from urllib to better split provided URLs.
Addresses containing query strings, parameters, passwords or fragments no longer fail silently.
SSH addresses containing paths are no longer accepted.

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-01 15:44:43 -07:00
Joffrey F 6bfe2005e0 Clear error for cancellable streams over SSH
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-01 15:24:22 -07:00
Joffrey F 94aa9a89f7 Update tests to properly dispose of client instances in tearDown
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-01 15:24:22 -07:00
Joffrey F 1df021ee24 Update tests for ssh protocol compatibility
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-01 15:24:22 -07:00
Joffrey F a3111d9e00 Add xfail to ignore 18.09 beta bug
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-10-31 18:05:26 -07:00
Joffrey F 82445764e0 Add support for RollbackConfig
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-08-09 16:41:25 -07:00
Joffrey F 14524f19e2 Add version checks and test
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-08-09 15:56:11 -07:00
Joffrey F cc766633de
Merge pull request #2103 from asottile/allow_uid_integer_0
Allow user=0 to be passed in create_container
2018-08-06 14:21:32 -07:00
Joffrey F c28ff85542 Improve placement handling in DockerClient.services.create
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-08-03 14:04:04 -07:00
Anthony Sottile 3c9738a584 Allow user=0 to be passed in create_container
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2018-08-02 12:00:55 -07:00
Joffrey F b3d2e54a2d
Merge pull request #2063 from mtszb/master
Add support for `uts_mode` parameter in `Client.create_host_config`.
2018-06-29 11:20:51 -07:00
Marco Trillo 098318ad95 Add support for `uts_mode` parameter in `Client.create_host_config`.
This parameter allows to set the UTS namespace of the container, as in
the `--uts=X` Docker CLI parameter:
<https://docs.docker.com/engine/reference/run/#uts-settings---uts>
The only allowed value, if set, is "host".

Signed-off-by: Marco Trillo <martri@arantia.com>
Signed-off-by: Diego Alvarez <dyako.developer@gmail.com>
2018-06-29 14:54:49 +02:00
Joffrey F ced86ec813 On Windows, convert paths to use forward slashes before fnmatch call
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-28 17:11:24 -07:00
Joffrey F 81b7d48ad6 Improved .dockerignore pattern processing to better match Docker CLI behavior
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-28 17:11:24 -07:00
Joffrey F e195e022cf Fix detach assert function to account for new behavior in engine 18.06
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-28 16:33:06 -07:00
Joffrey F 8c35eee0fb Fix support for legacy .dockercfg auth config format
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-27 17:04:32 -07:00
Joffrey F f1189bfb4b Allow passing of env overrides to credstore through APIClient ctor
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-08 15:43:58 -07:00
Joffrey F dbe52dcb7d Fix socket reading function for TCP (non-HTTPS) connections on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-06 17:53:50 -07:00
Joffrey F b4efdc1b28 Fix several integration tests on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-05-25 10:11:02 -07:00
Joffrey F 95ad903c35 Fix create_plugin on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-05-25 10:11:02 -07:00
Joffrey F 17f41b5672 Avoid unwanted modification of dockerfile path
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-05-25 10:11:02 -07:00
Joffrey F 9709dd454b Add ignore_removed param to containers.list() to control whether to
raise or ignore NotFound

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-25 17:18:26 -07:00
Joffrey F 827bd98d07 Merge branch 'master' of github.com:docker/docker-py 2018-04-25 16:30:24 -07:00
Joffrey F 8360ecae97 prune_builds test
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-25 16:29:41 -07:00
Joffrey F ae8f77737c Fix session timeout = None case
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-25 15:31:26 -07:00
Joffrey F da028d88a2 Total timeout should be HTTP timeout + operation timeout
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-25 15:31:26 -07:00
Matthieu Nottale cef9940ed3 stop(), restart(): Adjust request timeout.
Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
2018-04-25 15:31:26 -07:00
Joffrey F 1d6f8ecf92 Support absolute paths for in-context Dockerfiles
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-12 13:22:47 -07:00
Joffrey F 16751ac509 Properly handle relative Dockerfile paths and Dockerfile on different drives
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-30 11:00:41 -07:00
Joffrey F 9ff787cb5f Add methods for /distribution/<name>/json endpoint
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-29 15:45:06 -07:00
Joffrey F 081b78f15e Support building with Dockerfile outside of context
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-27 11:12:05 -07:00
Joffrey F c88db80f01 Add isolation param to build
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-23 14:14:49 +01:00
Joffrey F 7a28cad58e Don't descend into symlinks when building context tar
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-21 14:20:41 +01:00
Joffrey F 284c3d90d6 Remove redundant single-socket select call
Clean up + use pytest-timeout

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-20 09:25:29 +01:00
Viktor Adam 719d4e9e20 Allow cancelling the streams from other threads
Signed-off-by: Viktor Adam <rycus86@gmail.com>
2018-03-20 09:25:29 +01:00
Joffrey F 884261e241 Fix socket tests for TLS-enabled tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-15 16:37:58 -07:00
Joffrey F 90c0dbe5f8 Add test for container list with sparse=True
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-14 16:53:56 -07:00
Joffrey F 33f1ca9a48 Use same split rules for Dockerfile as other include/exclude patterns
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-14 14:11:42 -07:00
Joffrey F 13609359ac Improve dockerignore comment test
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-05 11:49:43 -08:00
Wanzhi Du 74586cdd4c Fix flake8 case
Signed-off-by: Wanzhi Du <wanzhi09@gmail.com>
2018-03-05 19:26:56 +08:00
Wanzhi Du 7a28ff3510 Ignore comment line from the .dockerignore file
This fixed the bug that test comment line in .dockerignore file as ignore rule
bug.

Add test for "# comment" patterns in .dockerignore.

Signed-off-by: Wanzhi Du <wanzhi09@gmail.com>
2018-03-05 18:10:09 +08:00
Joffrey F 9b8e022fa1
Merge pull request #1928 from mnottale/fix-spurious-resolution-macos-slowdown
Workaround requests resolving our unix socket URL on macosx.
2018-02-27 08:58:59 -08:00
Joffrey F fe966764ef
Merge pull request #1927 from mefyl/master
Add test for "/.." patterns in .dockerignore.
2018-02-26 10:53:41 -08:00
Matthieu Nottale 15c26e7057 Workaround requests resolving our unix socket URL on macosx.
Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
2018-02-26 14:47:26 +01:00
mefyl 4295919103
Add test for "/.." patterns in .dockerignore.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-26 12:59:46 +01:00
Yong Tang ab1f90a379 Cleanup containers during the tests
This fix tries to clean up the containers during the tests
so that no pre-existing volumes left in docker integration tests.

This fix adds `-v` when removing containers, and makes sure
containers launched in non-daemon mode are removed.

This fix is realted to moby PR 36292

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-23 15:22:42 +00:00
Joffrey F 9a4cc53c52 Merge branch 'release' into 3.1.0-release
Signed-off-by: Joffrey F <joffrey@docker.com>

Conflicts:
	docker/version.py
	tests/unit/api_test.py
	tests/unit/utils_test.py
2018-02-22 13:36:15 -08:00
Joffrey F cc6e1b1249
Merge pull request #1914 from mefyl/master
Improve .dockerignore compliance
2018-02-22 13:35:41 -08:00