mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-07 14:32:09 +00:00
Merge pull request #13160 from runcom/remove-api-codepath-less-than-1-12
Remove API codepaths < 1.12
This commit is contained in:
@@ -11,21 +11,6 @@ import (
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestLegacyImages(c *check.C) {
|
||||
status, body, err := sockRequest("GET", "/v1.6/images/json", nil)
|
||||
c.Assert(status, check.Equals, http.StatusOK)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
images := []types.LegacyImage{}
|
||||
if err = json.Unmarshal(body, &images); err != nil {
|
||||
c.Fatalf("Error on unmarshal: %s", err)
|
||||
}
|
||||
|
||||
if len(images) == 0 || images[0].Tag == "" || images[0].Repository == "" {
|
||||
c.Fatalf("Bad data: %q", images)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestApiImagesFilter(c *check.C) {
|
||||
name := "utest:tag1"
|
||||
name2 := "utest/docker:tag2"
|
||||
|
||||
@@ -18,40 +18,27 @@ func (s *DockerSuite) TestInspectApiContainerResponse(c *check.C) {
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
// test on json marshal version
|
||||
// and latest version
|
||||
testVersions := []string{"v1.11", "latest"}
|
||||
endpoint := "/containers/" + cleanedContainerID + "/json"
|
||||
status, body, err := sockRequest("GET", endpoint, nil)
|
||||
c.Assert(status, check.Equals, http.StatusOK)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
for _, testVersion := range testVersions {
|
||||
endpoint := "/containers/" + cleanedContainerID + "/json"
|
||||
if testVersion != "latest" {
|
||||
endpoint = "/" + testVersion + endpoint
|
||||
}
|
||||
status, body, err := sockRequest("GET", endpoint, nil)
|
||||
c.Assert(status, check.Equals, http.StatusOK)
|
||||
c.Assert(err, check.IsNil)
|
||||
var inspectJSON map[string]interface{}
|
||||
if err = json.Unmarshal(body, &inspectJSON); err != nil {
|
||||
c.Fatalf("unable to unmarshal body for latest version: %v", err)
|
||||
}
|
||||
|
||||
var inspectJSON map[string]interface{}
|
||||
if err = json.Unmarshal(body, &inspectJSON); err != nil {
|
||||
c.Fatalf("unable to unmarshal body for %s version: %v", testVersion, err)
|
||||
}
|
||||
keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
||||
|
||||
keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
||||
keys = append(keys, "Id")
|
||||
|
||||
if testVersion == "v1.11" {
|
||||
keys = append(keys, "ID")
|
||||
} else {
|
||||
keys = append(keys, "Id")
|
||||
}
|
||||
|
||||
for _, key := range keys {
|
||||
if _, ok := inspectJSON[key]; !ok {
|
||||
c.Fatalf("%s does not exist in response for %s version", key, testVersion)
|
||||
}
|
||||
}
|
||||
//Issue #6830: type not properly converted to JSON/back
|
||||
if _, ok := inspectJSON["Path"].(bool); ok {
|
||||
c.Fatalf("Path of `true` should not be converted to boolean `true` via JSON marshalling")
|
||||
for _, key := range keys {
|
||||
if _, ok := inspectJSON[key]; !ok {
|
||||
c.Fatalf("%s does not exist in response for latest version", key)
|
||||
}
|
||||
}
|
||||
//Issue #6830: type not properly converted to JSON/back
|
||||
if _, ok := inspectJSON["Path"].(bool); ok {
|
||||
c.Fatalf("Path of `true` should not be converted to boolean `true` via JSON marshalling")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user