moby--moby/integration
Sebastiaan van Stijn 9d1b4f5fc3
Add regression tests for invalid platform status codes
Before we handled containerd errors, using an invalid platform produced a 500 status:

```bash
curl -v \
  -X POST \
  --unix-socket /var/run/docker.sock \
  "http://localhost:2375/v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest" \
  -H "Content-Type: application/json"
```

```
* Connected to localhost (docker.sock) port 80 (#0)
> POST /v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest HTTP/1.1
> Host: localhost:2375
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 500 Internal Server Error
< Api-Version: 1.40
< Content-Length: 85
< Content-Type: application/json
< Date: Mon, 15 Jul 2019 15:25:44 GMT
< Docker-Experimental: true
< Ostype: linux
< Server: Docker/19.03.0-rc2 (linux)
<
{"message":"\"foobar\": unknown operating system or architecture: invalid argument"}
```

That problem is now fixed, and the API correctly returns a 4xx status:

```bash
curl -v \
  -X POST \
  --unix-socket /var/run/docker.sock \
  "http://localhost:2375/v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest" \
  -H "Content-Type: application/json"
```

```
* Connected to localhost (/var/run/docker.sock) port 80 (#0)
> POST /v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest HTTP/1.1
> Host: localhost:2375
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 400 Bad Request
< Api-Version: 1.41
< Content-Type: application/json
< Docker-Experimental: true
< Ostype: linux
< Server: Docker/dev (linux)
< Date: Mon, 15 Jul 2019 15:13:42 GMT
< Content-Length: 85
<
{"message":"\"foobar\": unknown operating system or architecture: invalid argument"}
* Curl_http_done: called premature == 0
```

This patch adds tests to validate the behaviour

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-15 20:37:00 +02:00
..
build Add regression tests for invalid platform status codes 2019-07-15 20:37:00 +02:00
config Add test for keeping same daemon ID on upgrade 2019-06-18 01:40:25 +00:00
container Move kill health test to integration 2019-07-14 11:53:21 +02:00
image Add regression tests for invalid platform status codes 2019-07-15 20:37:00 +02:00
internal Merge pull request #39240 from olljanat/enable-new-integration-tests-for-win 2019-06-11 14:24:03 -07:00
network Merge pull request #39431 from thaJeztah/macvlan_redundant_checks 2019-07-15 11:33:15 +02:00
plugin integration: change testGraphDriver signature to fix linting 2019-06-07 13:05:51 +02:00
secret Fatalf -> Fatal 2019-01-27 00:43:24 +00:00
service Merge pull request #38441 from sirlatrom/swarm_plugin_env 2019-07-08 15:26:55 -04:00
session Testing: create new daemon (only) if needed 2019-02-23 13:32:59 +01:00
system Revert "Remove Schema1 integration test suite" 2019-06-18 00:23:04 +00:00
testdata/https
volume Merge pull request #39240 from olljanat/enable-new-integration-tests-for-win 2019-06-11 14:24:03 -07:00
doc.go Add canonical import comment 2018-02-05 16:51:57 -05:00