1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integ-cli: Use status code from sockRequest (fix #12335)

sockRequest now makes the status code available in the returned
values. This helps avoid string checking for non-HttpStatusOK(=200)
yet successful error messages.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
Ahmet Alp Balkan 2015-04-14 08:00:46 +00:00
parent 00eddf5e67
commit 531433e765
2 changed files with 14 additions and 14 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"net/http"
"os"
"os/exec"
"strings"
@ -64,12 +65,11 @@ func TestRmRunningContainerCheckError409(t *testing.T) {
createRunningContainer(t, "foo")
endpoint := "/containers/foo"
_, _, err := sockRequest("DELETE", endpoint, nil)
status, _, err := sockRequest("DELETE", endpoint, nil)
if err == nil {
t.Fatalf("Expected error, can't rm a running container")
}
if !strings.Contains(err.Error(), "409 Conflict") {
} else if status != http.StatusConflict {
t.Fatalf("Expected error to contain '409 Conflict' but found %s", err)
}