api: update test to reflect reality on Windows

The TestInspectAPIContainerResponse mentioned that Windows does not
support API versions before v1.25.

While technically, no stable release existed for Windows with API versions
before that (see f811d5b128), API version
v1.24 was enabled in e4af39aeb3, to have
a consistend fallback version for API version negotiation.

This patch updates the test to reflect that change.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-01-22 01:03:07 +01:00
parent 570d5a9645
commit ed93110e11
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 4 additions and 16 deletions

View file

@ -20,26 +20,15 @@ func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
keysBase := []string{ keysBase := []string{
"Id", "State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "Id", "State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings",
"ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "MountLabel", "ProcessLabel", "GraphDriver", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "MountLabel", "ProcessLabel", "GraphDriver",
"Mounts",
} }
type acase struct { cases := []struct {
version string version string
keys []string keys []string
}{
{version: "v1.24", keys: keysBase},
} }
var cases []acase
if testEnv.DaemonInfo.OSType == "windows" {
// Windows only supports 1.25 or later
cases = []acase{
{"v1.25", append(keysBase, "Mounts")},
}
} else {
cases = []acase{
{"v1.24", append(keysBase, "Mounts")},
}
}
for _, cs := range cases { for _, cs := range cases {
body := getInspectBody(c, cs.version, cleanedContainerID) body := getInspectBody(c, cs.version, cleanedContainerID)

View file

@ -31,7 +31,6 @@ func TestInfoBinaryCommits(t *testing.T) {
func TestInfoAPIVersioned(t *testing.T) { func TestInfoAPIVersioned(t *testing.T) {
ctx := testutil.StartSpan(baseContext, t) ctx := testutil.StartSpan(baseContext, t)
// Windows only supports 1.25 or later
res, body, err := req.Get(ctx, "/v1.24/info") res, body, err := req.Get(ctx, "/v1.24/info")
assert.NilError(t, err) assert.NilError(t, err)