Commit Graph

48 Commits

Author SHA1 Message Date
Francesco Zardi ee44930ab2 Check presence of errors in server response to image push
When pushing an image, the server response might have status code
200 (OK) even though the operation has failed.

To detect the occurrence of an error, inspect each JSON chunk in
the server response and verify that no "error" field is present.

Fixes: #3277

Signed-off-by: Francesco Zardi <frazar0@hotmail.it>
2024-09-14 19:31:35 +02:00
Francesco Zardi c7d4ec1421 Add image.push() unit test with stream response
Signed-off-by: Francesco Zardi <frazar0@hotmail.it>
2024-09-14 19:03:03 +02:00
Aarni Koskela d50cc429c2 Enable Ruff I (import sort), autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 21:28:56 +02:00
Aarni Koskela 08956b5fbc
ci: update Ruff & fix some minor issues (#3206)
Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 13:49:07 -05:00
Aarni Koskela 0566f1260c Fix missing asserts or assignments
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Aarni Koskela 8447f7b0f0 Enable Ruff B rules and autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Aarni Koskela 8a3402c049 Replace string formatting with f-strings
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Felix Fontein 3178c8d48b
deps: compatiblity with requests ≥ 2.29.0 and urllib3 2.x (#3116)
Requirements are the same, so it's still possible to use `urllib3 < 2`
or `requests == 2.28.2` for example.

Signed-off-by: Felix Fontein <felix@fontein.de>
2023-05-05 11:39:31 -04:00
Ben Fasoli 23cf16f03a
client: use 12 character short IDs (#2862)
Use 12 characters for Docker resource IDs for
consistency with the Docker CLI.

Signed-off-by: Ben Fasoli <benfasoli@gmail.com>
2022-07-29 09:06:22 -04:00
Karthikeyan Singaravelan adf5a97b12
lint: fix deprecation warnings from threading package (#2823)
Set `daemon` attribute instead of using `setDaemon` method that
was deprecated in Python 3.10.

Signed-off-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2022-07-27 15:25:11 -04:00
Hugo van Kemenade 4bb99311e2 Don't install mock backport
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Anthony Sottile 5fcc293ba2 use python3.6+ constructs
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2021-07-05 18:30:07 -04:00
aiordache c7c5b551fc set engine version for unit tests to avoid querying the engine
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-08-20 15:29:24 +02: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 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 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 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
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 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 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 4c708f568c Fix test_login flakes
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-14 16:22:33 -08:00
Joffrey F 539b321bd1 Add login data to the right subdict in auth_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:38:19 -08:00
Joffrey F 83d185d695 Add login data to the right subdict in auth_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-01 16:02:09 -08:00
Joffrey F df8422d079 Refuse API version < 1.21 ; Remove associated code paths
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 14:42:01 -08:00
Joffrey F 3422211309 Use pytest asserts
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 14:26:24 -08:00
Joffrey F d9df2a8b75 Fix handling of non-multiplexed (TTY) streams over upgraded sockets
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
Joffrey F c5d35026ce Set infinite timeout for the `events` method
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-27 15:57:36 -07:00
Damien Nadé f36ef399ad Fixed events command related unit tests by passing a timeout value
Signed-off-by: Damien Nadé <github@livna.org>
2017-02-21 18:21:10 +01:00
Ben Firshman 94083f25ac
Start to rename docker-py to docker-sdk-python
Pretty much everything except renaming the GitHub repo and
documentation, which is not actually done yet. Nearer the release
we can do a search/replace for all that stuff.

Ref #1310

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-28 16:45:59 +00:00
Ben Firshman 1984f68730
Add new user-focused API
See #1086

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:05:43 +00:00
Ben Firshman 39900c558c
Move APIClient tests into single file
For some reason this was spread across two files.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:04 +00:00
Ben Firshman e055a1c813
Rename DockerClientTest to BaseAPIClientTest
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:04 +00:00
Ben Firshman 9daa320454
Rename Client to APIClient
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman d5bc7dc99a
Drop support for Python 2.6
Because it's ancient. If you're still using it, you can use an old
version of docker-py.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Aanand Prasad c66c2d6fa5 Fix linting error
This seems to have been ignored by older versions of flake8, and fixed
in version 3.1.0 or 3.1.1.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-14 18:20:13 +00:00
Joffrey F cec3fe7c31 Update tests to avoid failures on Windows platforms
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-14 16:02:28 -07:00
Ben Firshman 6220636536
Fix a few pep8 issues
autopep8 --in-place --recursive --experimental -aaa --ignore E309 .

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-09-14 16:54:54 +01:00
Ben Firshman 3769c089e8
Fix licenses
* Complete main LICENSE
* Remove unnecessary licenses from individual files

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-09-05 17:48:09 +02:00
Joffrey F fb41965272 Merge pull request #1082 from masci/fix_stream_helper
Invoke self._result passing `json=True` when `decode=True`
2016-08-23 15:34:35 -07:00
Tomas Tomecek 08b284ab39 docker client consistency: don't quote ':/'
E.g.

docker client

`/v1.21/images/localhost:5000/busybox/push?tag=`

docker-py

`/v1.21/images/localhost%3A5000%2Fbusybox/push`

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2016-08-10 09:30:19 +02:00
Ben Firshman bd73225e14
Set custom user agent on client
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-07-20 15:04:54 -07:00
Joffrey F e64ba8f2b9 Mock read_from_socket method
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-13 17:08:17 -04:00
Massimiliano Pippi 86d1b8fb83 invoke self._result with json=True if decode=True
Signed-off-by: Massimiliano Pippi <massi@datadoghq.com>
2016-06-07 10:32:02 -04:00
Dustin Falgout e0c6ec0343 incorporate feedback
Signed-off-by: Dustin Falgout <dustin@falgout.us>
2015-12-04 01:27:44 -06:00
Joffrey F 93a296fb04 Reorganize test directories
More clearly separate unit and integration tests
Allow splitting into multiple files
Cleaner

Signed-off-by: Joffrey F <joffrey@docker.com>
2015-10-21 16:02:09 -07:00