Revert "API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields"

This reverts commit 5d2006256f, which
caused some issues in the docker/cli formatting code that needs some
investigating.

Let's (temporarily) revert this while we look what's wrong.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-04-11 14:47:10 +02:00
parent 73520a5ab7
commit eacbbdeec6
5 changed files with 12 additions and 92 deletions

View File

@@ -3,13 +3,9 @@
package system // import "github.com/docker/docker/integration/system"
import (
"encoding/json"
"io"
"net/http"
"testing"
"github.com/docker/docker/client"
"github.com/docker/docker/testutil/request"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -51,56 +47,3 @@ func TestInfoBinaryCommits(t *testing.T) {
assert.Check(t, is.Equal(info.RuncCommit.Expected, info.RuncCommit.ID)) //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.49.
})
}
func TestInfoLegacyFields(t *testing.T) {
ctx := setupTest(t)
const notPresent = "expected field to not be present"
tests := []struct {
name string
url string
expectedFields map[string]any
}{
{
name: "api v1.48 legacy bridge-nftables",
url: "/v1.48/info",
expectedFields: map[string]any{
"BridgeNfIp6tables": false,
"BridgeNfIptables": false,
},
},
{
name: "api v1.49 legacy bridge-nftables",
url: "/v1.49/info",
expectedFields: map[string]any{
"BridgeNfIp6tables": notPresent,
"BridgeNfIptables": notPresent,
},
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
res, _, err := request.Get(ctx, tc.url)
assert.NilError(t, err)
assert.Equal(t, res.StatusCode, http.StatusOK)
body, err := io.ReadAll(res.Body)
assert.NilError(t, err)
actual := map[string]any{}
err = json.Unmarshal(body, &actual)
assert.NilError(t, err, string(body))
for field, expectedValue := range tc.expectedFields {
if expectedValue == notPresent {
_, found := actual[field]
assert.Assert(t, !found, "field %s should not be present", field)
} else {
_, found := actual[field]
assert.Assert(t, found, "field %s should be present", field)
assert.Check(t, is.DeepEqual(actual[field], expectedValue))
}
}
})
}
}