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>
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>
This test can fail if `eth0` has multiple IP addresses;
E docker.errors.APIError: 400 Client Error: Bad Request ("interface eth0 has more than one IPv6 address (2001:db8:1::242:ac11:2 and fe80::42:acff:fe11:2)")
Which is not a failiure, but depends on the environment that
the test is run in.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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>
- 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>
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>
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>
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>