Commit Graph

19 Commits

Author SHA1 Message Date
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
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
Anthony Sottile 5fcc293ba2 use python3.6+ constructs
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2021-07-05 18:30:07 -04:00
Ulysses Souza c8fba210a2 Remove support to pre python 3.6
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-03-22 10:18:23 -03:00
aiordache cec152db5f Set image default tag on pull
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-09-16 17:36:50 +02:00
Sebastiaan van Stijn 54b48a9b7a
Update alpine version to 3.10, and rename BUSYBOX variable
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-10 19:11:58 +02:00
Sebastiaan van Stijn bc46490a68
Adjust `--platform` tests for changes in docker engine
These tests started failing on recent versions of the engine because the error string changed,
and due to a regression, the status code for one endpoint changed from a 400 to a 500.

On Docker 18.03:

The `docker build` case properly returns a 400, and "invalid platform" as error string;

```bash
docker build --platform=foobar -<<EOF
FROM busybox
EOF

Sending build context to Docker daemon  2.048kB
Error response from daemon: invalid platform: invalid platform os "foobar"
```

```
DEBU[2019-07-15T12:17:22.745511870Z] Calling GET /_ping
DEBU[2019-07-15T12:17:22.748224796Z] Calling POST /session
DEBU[2019-07-15T12:17:22.748692282Z] Calling POST /v1.37/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&platform=foobar&rm=1&session=d7b6ceba9d8d0aed67a805528554feb5285781fe888a4bf4e0c15cb09bffd614&shmsize=0&target=&ulimits=null
```

The `docker pull --platform=foobar hello-world:latest` case incorrectly returns a 500

```
DEBU[2019-07-15T12:16:08.744827612Z] Calling POST /v1.37/images/create?fromImage=hello-world&platform=foobar&tag=latest
DEBU[2019-07-15T12:16:08.745594874Z] FIXME: Got an API for which error does not match any expected type!!!: invalid platform: invalid platform os "foobar"  error_type="*errors.errorString" module=api
ERRO[2019-07-15T12:16:08.745916686Z] Handler for POST /v1.37/images/create returned error: invalid platform: invalid platform os "foobar"
DEBU[2019-07-15T12:16:08.746191172Z] FIXME: Got an API for which error does not match any expected type!!!: invalid platform: invalid platform os "foobar"  error_type="*errors.errorString" module=api
```

On Docker 18.09;

```bash
docker build --platform=foobar -<<EOF
FROM busybox
EOF

Error response from daemon: "foobar": unknown operating system or architecture: invalid argument
```

Which incorrectly returns a 500 status;

```
DEBU[2019-07-15T11:59:20.687268380Z] Calling POST /v1.39/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&platform=foobar&rm=1&session=jko7kejjvs93judyfnq7shoda&shmsize=0&target=&ulimits=null&version=1
DEBU[2019-07-15T11:59:20.687282279Z] Calling POST /session
INFO[2019-07-15T11:59:20.687761392Z] parsed scheme: ""                             module=grpc
INFO[2019-07-15T11:59:20.687833668Z] scheme "" not registered, fallback to default scheme  module=grpc
INFO[2019-07-15T11:59:20.688017578Z] ccResolverWrapper: sending new addresses to cc: [{ 0  <nil>}]  module=grpc
INFO[2019-07-15T11:59:20.688270160Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-07-15T11:59:20.688353083Z] pickfirstBalancer: HandleSubConnStateChange: 0xc4209b0630, CONNECTING  module=grpc
INFO[2019-07-15T11:59:20.688985698Z] pickfirstBalancer: HandleSubConnStateChange: 0xc4209b0630, READY  module=grpc
DEBU[2019-07-15T11:59:20.812700550Z] client is session enabled
DEBU[2019-07-15T11:59:20.813139288Z] FIXME: Got an API for which error does not match any expected type!!!: invalid argument
github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs.init
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs/errors.go:40
github.com/docker/docker/vendor/github.com/containerd/containerd/content.init
	<autogenerated>:1
github.com/docker/docker/builder/builder-next.init
	<autogenerated>:1
github.com/docker/docker/api/server/backend/build.init
	<autogenerated>:1
main.init
	<autogenerated>:1
runtime.main
	/usr/local/go/src/runtime/proc.go:186
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:2361  error_type="*errors.fundamental" module=api
ERRO[2019-07-15T11:59:20.813210677Z] Handler for POST /v1.39/build returned error: "foobar": unknown operating system or architecture: invalid argument
DEBU[2019-07-15T11:59:20.813276737Z] FIXME: Got an API for which error does not match any expected type!!!: invalid argument
github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs.init
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs/errors.go:40
github.com/docker/docker/vendor/github.com/containerd/containerd/content.init
	<autogenerated>:1
github.com/docker/docker/builder/builder-next.init
	<autogenerated>:1
github.com/docker/docker/api/server/backend/build.init
	<autogenerated>:1
main.init
	<autogenerated>:1
runtime.main
	/usr/local/go/src/runtime/proc.go:186
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:2361  error_type="*errors.fundamental" module=api
```

Same for the `docker pull --platform=foobar hello-world:latest` case:

```bash
docker pull --platform=foobar hello-world:latest
Error response from daemon: "foobar": unknown operating system or architecture: invalid argument
```

```
DEBU[2019-07-15T12:00:18.812995330Z] Calling POST /v1.39/images/create?fromImage=hello-world&platform=foobar&tag=latest
DEBU[2019-07-15T12:00:18.813229172Z] FIXME: Got an API for which error does not match any expected type!!!: invalid argument
github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs.init
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs/errors.go:40
github.com/docker/docker/vendor/github.com/containerd/containerd/content.init
	<autogenerated>:1
github.com/docker/docker/builder/builder-next.init
	<autogenerated>:1
github.com/docker/docker/api/server/backend/build.init
	<autogenerated>:1
main.init
	<autogenerated>:1
runtime.main
	/usr/local/go/src/runtime/proc.go:186
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:2361  error_type="*errors.fundamental" module=api
ERRO[2019-07-15T12:00:18.813365546Z] Handler for POST /v1.39/images/create returned error: "foobar": unknown operating system or architecture: invalid argument
DEBU[2019-07-15T12:00:18.813461428Z] FIXME: Got an API for which error does not match any expected type!!!: invalid argument
github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs.init
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/errdefs/errors.go:40
github.com/docker/docker/vendor/github.com/containerd/containerd/content.init
	<autogenerated>:1
github.com/docker/docker/builder/builder-next.init
	<autogenerated>:1
github.com/docker/docker/api/server/backend/build.init
	<autogenerated>:1
main.init
	<autogenerated>:1
runtime.main
	/usr/local/go/src/runtime/proc.go:186
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:2361  error_type="*errors.fundamental" module=api
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-15 15:48:06 +02:00
Joffrey F bedabbfa35 Add methods for /distribution/<name>/json endpoint
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-29 16:25:14 -07: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 388f291b13 Update save / export methods to return data generators
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-26 16:23:55 -08:00
Joffrey F f95b958429 Add support for experimental platform flag in build and pull
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-23 16:59:09 -08:00
Joffrey F 7139e2d8f1 Return generator for output of load_image endpoint
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
Cecile Tonglet 9e793806ff Return the result of the API when using remove_image and load_image
Those calls return result that can be used by the developers.

Signed-off-by: Cecile Tonglet <cecile.tonglet@gmail.com>
2017-08-17 13:38:40 -07:00
Bryan Boreham 234296171f Only pull the 'latest' tag when testing images
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2017-06-14 14:05:26 +00:00
Joffrey F 83b45b7d54 Add prune_networks method
Ensure all integration tests use the same version of the busybox image

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-30 18:54:18 -08:00
Joffrey F 89d3803344 Add prune_volumes method
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-30 18:53:46 -08:00
Joffrey F 7f0c2e7531 Add prune_images method
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-30 18:53:46 -08:00
Ben Firshman 6334312e47
Split out base integration test for APIClient
So the cleanup stuff can be reused for model tests.

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