Browse Source

Merge pull request #46907 from vvoland/c8d-fix-TestBuildClearCmd

c8d/integration-cli: Adjust TestBuildClearCmd
Sebastiaan van Stijn 1 year ago
parent
commit
abf9d0b07f
1 changed files with 7 additions and 3 deletions
  1. 7 3
      integration-cli/docker_cli_build_test.go

+ 7 - 3
integration-cli/docker_cli_build_test.go

@@ -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, "[]"))
 	}
 }