mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #8289 from duglin/FixTestcaseFor8230
Fixes the new testcase for PR #8230
This commit is contained in:
commit
7c1aee6291
1 changed files with 6 additions and 28 deletions
|
@ -296,17 +296,8 @@ func TestBuildCopyWildcardNoFind(t *testing.T) {
|
||||||
func TestBuildCopyWildcardCache(t *testing.T) {
|
func TestBuildCopyWildcardCache(t *testing.T) {
|
||||||
name := "testcopywildcardcache"
|
name := "testcopywildcardcache"
|
||||||
defer deleteImages(name)
|
defer deleteImages(name)
|
||||||
server, err := fakeStorage(map[string]string{
|
|
||||||
"robots.txt": "hello",
|
|
||||||
"index.html": "world",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer server.Close()
|
|
||||||
ctx, err := fakeContext(`FROM busybox
|
ctx, err := fakeContext(`FROM busybox
|
||||||
COPY file1.txt /tmp/
|
COPY file1.txt /tmp/`,
|
||||||
`,
|
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"file1.txt": "test1",
|
"file1.txt": "test1",
|
||||||
})
|
})
|
||||||
|
@ -315,30 +306,17 @@ func TestBuildCopyWildcardCache(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
id1, err := buildImageFromContext(name, ctx, true)
|
id1, err := buildImageFromContext(name, ctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now make sure we use a cache the 2nd time even with wild card
|
// Now make sure we use a cache the 2nd time even with wild cards.
|
||||||
ctx2, err := fakeContext(`FROM busybox
|
// Use the same context so the file is the same and the checksum will match
|
||||||
COPY file*.txt /tmp/
|
ctx.Add("Dockerfile", `FROM busybox
|
||||||
`,
|
COPY file*.txt /tmp/`)
|
||||||
map[string]string{
|
|
||||||
"file1.txt": "test1",
|
|
||||||
})
|
|
||||||
defer ctx2.Close()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
id2, err := buildImageFromContext(name, ctx, true)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
id2, err := buildImageFromContext(name, ctx2, true)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue