mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add test for builder cache with root source path
Fixes #17827 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
470fc94f38
commit
86faf1e165
1 changed files with 27 additions and 0 deletions
|
@ -6408,3 +6408,30 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *check.C) {
|
||||||
c.Assert(out, checker.Matches, "bar")
|
c.Assert(out, checker.Matches, "bar")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #17827
|
||||||
|
func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) {
|
||||||
|
testRequires(c, DaemonIsLinux)
|
||||||
|
name := "testbuildrootsource"
|
||||||
|
ctx, err := fakeContext(`
|
||||||
|
FROM busybox
|
||||||
|
COPY / /data`,
|
||||||
|
map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
})
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
defer ctx.Close()
|
||||||
|
|
||||||
|
// warm up cache
|
||||||
|
_, err = buildImageFromContext(name, ctx, true)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
// change file, should invalidate cache
|
||||||
|
err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
_, out, err := buildImageFromContextWithOut(name, ctx, true)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
c.Assert(out, checker.Not(checker.Contains), "Using cache")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue