Commit Graph

438 Commits

Author SHA1 Message Date
Sebastiaan van Stijn fad84c371a
integration: test_create_volume_invalid_driver allow either 400 or 404
The API currently returns a 404 error when trying to create a volume with
an invalid (non-existing) driver. We are considering changing this status
code to be a 400 (invalid parameter), as even though the _reason_ of the
error may be that the plugin / driver is not found, the _cause_ of the
error is that the user provided a plugin / driver that's invalid for the
engine they're connected to.

This patch updates the test to pass for either case.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-14 14:23:24 +01:00
Sebastiaan van Stijn 8ee28517c7
test_service_logs: stop testing experimental versions
Service logs are no longer experimental, so updating the tests
to only test against "stable"  implementations, and no longer
test the experimental ones.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-18 16:09:21 +01:00
Sebastiaan van Stijn e47e966e94
Bump default API version to 1.45 (Moby 26.0/26.1)
- Update API version to the latest maintained release.
0 Adjust tests for API 1.45

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-27 17:03:02 +01:00
Laura Brehm b1265470e6
tests/exec: add test for exit code from exec
Execs should return the exit code of the exec'd process, if it started.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-30 14:07:04 +01:00
Laura Brehm 96ef4d3bee
tests/exec: expect 127 exit code for missing executable
Docker Engine has always returned `126` when starting an exec fails due
to a missing binary, but this was due to a bug in the daemon causing the
correct exit code to be overwritten in some cases – see: https://github.com/moby/moby/issues/45795

Change tests to expect correct exit code (`127`).

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-27 15:33:11 +01:00
Milas Bowman 4c6437d292 Merge pull request #3212 from valohai/ruff-i 2024-03-29 13:28:43 -04:00
Rob Murray cb21af7f69 Fix tests that look at 'Aliases'
Inspect output for 'NetworkSettings.Networks.<network>.Aliases'
includes the container's short-id (although it will be removed
in API v1.45, in moby 26.0).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-03-13 14:54:25 +00: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
Paweł Gronowski 0fad869cc6
integration/commit: Don't check for deprecated fields
Container related Image fields (`Container` and `ContainerConfig`) will
be deprecated in API v1.44 and will be removed in v1.45.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-12-19 10:28:28 +01:00
Milas Bowman 26e07251d4 chore: fix lint issues
ruff ruff ruff!

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-11-20 16:11:06 -05:00
Milas Bowman b70cbd0129 Merge remote-tracking branch 'upstream/main' into Skazza94/main 2023-11-20 15:38:27 -05:00
Mariano Scazzariello 7752996f78
Replace `network_config` with a dict of EndpointConfig
- Renamed parameter from `network_config` to `networking_config` to be more semantically correct with the rest of the API.
2023-09-30 00:20:44 +02:00
Albin Kerouanton c38656dc78
integration: Remove test_create_check_duplicate (#3170)
integration: check_duplicate is now the default behavior

moby/moby#46251 marks CheckDuplicate as deprecated. Any NetworkCreate
request with a conflicting network name will now return an error.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-21 09:31:57 -04:00
Albin Kerouanton 378325363e
integration: Fix bad subnet declaration (#3169)
Some network integration tests are creating networks with subnet
`2001:389::1/64`. This is an invalid subnet as the host fragment is
non-zero (ie. it should be `2001:389::/64`).

PR moby/moby#45759 is adding strict validation of network configuration.
Docker API will now return an error whenever a bad subnet is passed.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-21 09:30:21 -04:00
Milas Bowman 0f0b20a6a7 Merge branch 'jannefleischer/main'
Manually merging #3164.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-08-15 14:04:29 -04:00
Janne Jakob Fleischer bea63224e0 volume: added support for bind propagation
https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation

Signed-off-by: Janne Jakob Fleischer <janne.fleischer@ils-forschung.de>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-08-15 10:35:07 -04:00
Milas Bowman 8b9ad7807f Merge branch 'ruffify'
Manually merging #3126.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-08-15 09:58:21 -04:00
Aarni Koskela 3948540c89 Fix or noqa B003 (assigning to os.environ doesn't do what you expect)
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03: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 601476733c Enable Ruff C rules and autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Aarni Koskela ec58856ee3 Clean up unnecessary noqa comments
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
Sebastiaan van Stijn 5064995bc4
tests/integration: update some tests for updated error-messages
I was in the process of cleaning up some error-messages, and it looks like
the docker-py tests were depending on strings that will be removed;

    =================================== FAILURES ===================================
    _____________ CreateContainerTest.test_create_with_restart_policy ______________
    tests/integration/api_container_test.py:126: in test_create_with_restart_policy
        assert 'You cannot remove ' in err
    E   AssertionError: assert 'You cannot remove ' in 'cannot remove container d11580f6078108691096ec8a23404a6bda9ad1d1b2bafe88b17d127a67728833: container is restarting: stop the container before removing or force remove'
    ____________________ ErrorsTest.test_api_error_parses_json _____________________
    tests/integration/errors_test.py:13: in test_api_error_parses_json
        assert 'You cannot remove a running container' in explanation
    E   AssertionError: assert 'You cannot remove a running container' in 'cannot remove container 4b90ce2e907dd0f99d0f561619b803e7a2a31809ced366c537874dd13f8a47ec: container is running: stop the container before removing or force remove'

This updates the tests to match on a string that will be present in both the
old and new error-messages, but added a "lower()", so that matching will be
done case-insensitive (Go errors generally should be lowercase).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 14:52:58 +02:00
Sebastiaan van Stijn fb974de27a
tests/integration: fix flake8 failures (E721 do not compare types)
Run flake8 docker/ tests/
      flake8 docker/ tests/
      shell: /usr/bin/bash -e {0}
      env:
        DOCKER_BUILDKIT: 1
        pythonLocation: /opt/hostedtoolcache/Python/3.11.4/x64
        PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib/pkgconfig
        Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
        Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
        Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
        LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib
    tests/integration/api_container_test.py:1395:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
    tests/integration/api_container_test.py:1408:24: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
    tests/integration/api_image_test.py:35:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
    tests/integration/api_image_test.py:46:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
    Error: Process completed with exit code 1.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 10:26:36 +02:00
Mariano Scazzariello e011ff5be8
More sanity checking of EndpointConfig params
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 12:40:08 +02:00
Lorin Bucher 7cd7458f2f
api: add `status` parameter to services list (#3093)
Signed-off-by: Lorin Bucher <lorin@lbtec.dev>
2023-02-16 10:38:52 -05:00
Yanlong Wang 22718ba59a
fix(store): warn on init instead of throw (#3080)
Signed-off-by: yanlong.wang <yanlong.wang@naiver.org>
2023-01-10 17:45:25 -05:00
Brian Goff bc0a5fbacd
test: use anonymous volume for prune (#3051)
This is related to https://github.com/moby/moby/pull/44216

Prunes will, by default, no longer prune named volumes, only anonymous ones.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-10-05 13:54:45 -04:00
Milas Bowman e901eac7a8
test: add additional tests for cgroupns option (#3024)
See #2930.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-08-12 14:27:53 -04:00
Chris Hand fc86ab0d85
swarm: add support for DataPathPort on init (#2987)
Adds support for setting the UDP port used for VXLAN traffic between
swarm nodes

Signed-off-by: Chris Hand <dexteradeus@users.noreply.github.com>
2022-08-12 09:58:57 -04:00
Milas Bowman c03aeb659e Merge remote-tracking branch 'upstream/main' into connect-with-mac 2022-08-12 09:21:51 -04:00
Quentin Mathorel 58aa62bb15
swarm: add sysctl support for services (#3029)
Signed-off-by: Quentin Mathorel <quentin.mathorel@outlook.fr>
2022-08-12 08:55:19 -04:00
Leonard Kinday 66402435d1
Support `global-job` and `replicated-job` modes in Docker Swarm (#3016)
Add `global-job` and `replicated-job` modes

Fixes #2829.

Signed-off-by: Leonard Kinday <leonard@kinday.ru>
2022-08-11 16:20:31 -04:00
Ningú 42789818be
credentials: eliminate distutils deprecation warnings (#3028)
While removing any usage of the deprecated `distutils` package,
("The distutils package is deprecated and slated for removal in Python 3.12.")
this internal utility can be removed straightaway because the
`shutil.which` replacement for `distutils.spawn.find_executable`
already honors the `PATHEXT` environment variable in windows systems.

See https://docs.python.org/3/library/shutil.html#shutil.which

Signed-off-by: Daniel Möller <n1ngu@riseup.net>
2022-08-02 10:19:50 -04:00
Clément Loiselet 3ee3a2486f
build: trim trailing whitespace from dockerignore entries (#2733)
fix(dockerignore): trim trailing whitespace

Signed-off-by: Clément Loiselet <clement.loiselet@capgemini.com>
2022-07-29 15:33:23 -04:00
ercildoune 26753c81de
api: add rollback_config to service create (#2917)
`rollback_config` was not in the list of `CREATE_SERVICE_KWARGS`
which prevented it from being an argument when creating services.
It has now been added and the problem fixed, allowing services to
have a rollback_config during creation and updating.

Fixes #2832.

Signed-off-by: Fraser Patten <pattenf00@gmail.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 14:54:55 -04:00
Till! 0031ac2186
api: add force to plugin disable (#2843)
Signed-off-by: till <till@php.net>
2022-07-29 14:51:43 -04:00
Milas Bowman 26064dd6b5
deps: upgrade websocket-client to latest (#3022)
* Upgrade websocket-client to latest
* Add basic integration test for streaming logs via websocket

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 11:09:47 -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
Milas Bowman b9ca58a56d
Merge pull request #3009 from milas/lint-flake8
ci: add flake8 job
2022-07-26 15:48:55 -04:00
Milas Bowman 3ffdd8a1c5 lint: fix outstanding flake8 violations
Since flake8 wasn't actually being run in CI, we'd accumulated some
violations.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:48:47 -04:00
Milas Bowman 4765f62441 test: mark invalid test as xfail
This test looks for some behavior on non-chunked HTTP requests.

It now fails because it looks like recent versions of Docker Engine
ALWAYS return chunked responses (or perhaps this specific response
changed somehow to now trigger chunking whereas it did not previously).

The actual logic it's trying to test is also unusual because it's
trying to hackily propagate errors under the assumption that it'd get
a non-chunked response on failure, which is...not reliable. Arguably,
the chunked reader should be refactored somehow but that's a refactor
we can't really commit to (and it's evidently been ok enough as is
up until now).

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:00:49 -04:00
Milas Bowman 74e0c5eb8c test: fix flaky container log test
Ensure the container has exited before attempting to grab the logs.

Since we are not streaming them, it's possible to attach + grab logs
before the output is processed, resulting in a test failure. If the
container has exited, it's guaranteed to have logged :)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:00:49 -04:00
Sebastiaan van Stijn 7168e09b16
test: fix for cgroupv2 (#2940)
This test was verifying that the container has the right options set (through
`docker inspect`), but also checks if the cgroup-rules are set within the
container by reading `/sys/fs/cgroup/devices/devices.list`

Unlike cgroups v1, on cgroups v2, there is no file interface, and rules are
handled through ebpf, which means that the test will fail because this file
is not present.

From the Linux documentation for cgroups v2:
https://github.com/torvalds/linux/blob/v5.16/Documentation/admin-guide/cgroup-v2.rst#device-controller

> (...)
> Device controller manages access to device files. It includes both creation of
> new device files (using mknod), and access to the existing device files.
>
> Cgroup v2 device controller has no interface files and is implemented on top
> of cgroup BPF. To control access to device files, a user may create bpf programs
> of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with
> BPF_CGROUP_DEVICE flag. (...)

Given that setting the right cgroups is not really a responsibility of this SDK,
it should be sufficient to verify that the right options were set in the container
configuration, so this patch is removing the part that checks the cgroup, to
allow this test to be run on a host with cgroups v2 enabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-26 12:06:51 -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
Anca Iordache 7779b84e87
Merge pull request #2809 from feliperuhland/add-service-capability
Add service capability
2021-10-08 00:01:28 +02:00
Anca Iordache aae6be0c58
Merge branch 'master' into feat/add_templating_parameter_docker_config 2021-10-07 23:29:03 +02:00
Anthony Sottile 5fcc293ba2 use python3.6+ constructs
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2021-07-05 18:30:07 -04:00