c8d/integration-cli: Adjust TestBuildClearCmd

Config serialization performed by the graphdriver implementation
maintained the distinction between an empty array and having no Cmd set.

With containerd integration we serialize the OCI types directly that use
the `omitempty` option which doesn't persist that distinction.

Considering that both values should have exactly the same semantics (no
cmd being passed) it should be fine if in this case the Cmd would be
null instead of an empty array.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-12-07 13:59:00 +01:00
parent 82a318db5f
commit 90dfb1c8ad
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -3144,9 +3144,13 @@ func (s *DockerCLIBuildSuite) TestBuildClearCmd(c *testing.T) {
ENTRYPOINT ["/bin/bash"]
CMD []`))
res := inspectFieldJSON(c, name, "Config.Cmd")
if res != "[]" {
c.Fatalf("Cmd %s, expected %s", res, "[]")
cmd := inspectFieldJSON(c, name, "Config.Cmd")
// OCI types specify `omitempty` JSON annotation which doesn't serialize
// empty arrays and the Cmd will not be present at all.
if testEnv.UsingSnapshotter() {
assert.Check(c, is.Equal(cmd, "null"))
} else {
assert.Check(c, is.Equal(cmd, "[]"))
}
}