mirror of https://github.com/docker/docs.git
integration-cli: add a integration test to avoid parsing null string in ADD, COPY and VOLUME to nil slice
Signed-off-by: Soshi Katsuta <katsuta_soshi@cyberagent.co.jp>
This commit is contained in:
parent
2d6952e8a5
commit
d45fcc6c80
|
@ -234,7 +234,7 @@ func parseString(rest string) (*Node, map[string]bool, error) {
|
||||||
func parseJSON(rest string) (*Node, map[string]bool, error) {
|
func parseJSON(rest string) (*Node, map[string]bool, error) {
|
||||||
rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
|
rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
|
||||||
if !strings.HasPrefix(rest, "[") {
|
if !strings.HasPrefix(rest, "[") {
|
||||||
return nil, nil, fmt.Errorf("Error parsing \"%s\" as a JSON array", rest)
|
return nil, nil, fmt.Errorf(`Error parsing "%s" as a JSON array`, rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
var myJSON []interface{}
|
var myJSON []interface{}
|
||||||
|
|
|
@ -5444,3 +5444,30 @@ func (s *DockerTrustSuite) TestBuildContextDirIsSymlink(c *check.C) {
|
||||||
c.Fatalf("build failed with exit status %d: %s", exitStatus, out)
|
c.Fatalf("build failed with exit status %d: %s", exitStatus, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #15634: COPY fails when path starts with "null"
|
||||||
|
func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
|
||||||
|
name := "testbuildnullstringinaddcopyvolume"
|
||||||
|
|
||||||
|
ctx, err := fakeContext(`
|
||||||
|
FROM busybox
|
||||||
|
|
||||||
|
ADD null /
|
||||||
|
COPY nullfile /
|
||||||
|
VOLUME nullvolume
|
||||||
|
`,
|
||||||
|
map[string]string{
|
||||||
|
"null": "test1",
|
||||||
|
"nullfile": "test2",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
c.Fatal(err)
|
||||||
|
}
|
||||||
|
defer ctx.Close()
|
||||||
|
|
||||||
|
if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
||||||
|
c.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue