Add test cases and docString for regex in COPY command (#2773)
This commit is contained in:
parent
c8c839a527
commit
b6f14ae676
|
|
@ -58,6 +58,7 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu
|
|||
return errors.Wrap(err, "getting user group from chown")
|
||||
}
|
||||
|
||||
// sources from the Copy command are resolved with wildcards {*?[}
|
||||
srcs, dest, err := util.ResolveEnvAndWildcards(c.cmd.SourcesAndDest, c.fileContext, replacementEnvs)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "resolving src")
|
||||
|
|
|
|||
|
|
@ -51,6 +51,21 @@ var copyTests = []struct {
|
|||
sourcesAndDest: []string{"foo", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy f* into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"foo*", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy fo? into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"fo?", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
{
|
||||
name: "copy f[o][osp] into tempCopyExecuteTest",
|
||||
sourcesAndDest: []string{"f[o][osp]", "tempCopyExecuteTest"},
|
||||
expectedDest: []string{"tempCopyExecuteTest"},
|
||||
},
|
||||
}
|
||||
|
||||
func setupTestTemp(t *testing.T) string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue