Signed-off-by: Darren Stahl <darst@microsoft.com>
| ... | ... |
@@ -531,7 +531,6 @@ func (s *DockerSuite) TestBuildCacheAdd(c *check.C) {
|
| 531 | 531 |
} |
| 532 | 532 |
|
| 533 | 533 |
func (s *DockerSuite) TestBuildLastModified(c *check.C) {
|
| 534 |
- testRequires(c, DaemonIsLinux) // Windows doesn't have httpserver image yet |
|
| 535 | 534 |
name := "testbuildlastmodified" |
| 536 | 535 |
|
| 537 | 536 |
server, err := fakeStorage(map[string]string{
|
| ... | ... |
@@ -545,32 +544,27 @@ func (s *DockerSuite) TestBuildLastModified(c *check.C) {
|
| 545 | 545 |
var out, out2 string |
| 546 | 546 |
|
| 547 | 547 |
dFmt := `FROM busybox |
| 548 |
-ADD %s/file / |
|
| 549 |
-RUN ls -le /file` |
|
| 548 |
+ADD %s/file /` |
|
| 550 | 549 |
|
| 551 | 550 |
dockerfile := fmt.Sprintf(dFmt, server.URL()) |
| 552 | 551 |
|
| 553 |
- if _, out, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 552 |
+ if _, _, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 554 | 553 |
c.Fatal(err) |
| 555 | 554 |
} |
| 556 | 555 |
|
| 557 |
- originMTime := regexp.MustCompile(`root.*/file.*\n`).FindString(out) |
|
| 558 |
- // Make sure our regexp is correct |
|
| 559 |
- if strings.Index(originMTime, "/file") < 0 {
|
|
| 560 |
- c.Fatalf("Missing ls info on 'file':\n%s", out)
|
|
| 561 |
- } |
|
| 556 |
+ out, _ = dockerCmd(c, "run", name, "ls", "-le", "/file") |
|
| 562 | 557 |
|
| 563 | 558 |
// Build it again and make sure the mtime of the file didn't change. |
| 564 | 559 |
// Wait a few seconds to make sure the time changed enough to notice |
| 565 | 560 |
time.Sleep(2 * time.Second) |
| 566 | 561 |
|
| 567 |
- if _, out2, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 562 |
+ if _, _, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 568 | 563 |
c.Fatal(err) |
| 569 | 564 |
} |
| 565 |
+ out2, _ = dockerCmd(c, "run", name, "ls", "-le", "/file") |
|
| 570 | 566 |
|
| 571 |
- newMTime := regexp.MustCompile(`root.*/file.*\n`).FindString(out2) |
|
| 572 |
- if newMTime != originMTime {
|
|
| 573 |
- c.Fatalf("MTime changed:\nOrigin:%s\nNew:%s", originMTime, newMTime)
|
|
| 567 |
+ if out != out2 {
|
|
| 568 |
+ c.Fatalf("MTime changed:\nOrigin:%s\nNew:%s", out, out2)
|
|
| 574 | 569 |
} |
| 575 | 570 |
|
| 576 | 571 |
// Now 'touch' the file and make sure the timestamp DID change this time |
| ... | ... |
@@ -585,13 +579,13 @@ RUN ls -le /file` |
| 585 | 585 |
|
| 586 | 586 |
dockerfile = fmt.Sprintf(dFmt, server.URL()) |
| 587 | 587 |
|
| 588 |
- if _, out2, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 588 |
+ if _, _, err = buildImageWithOut(name, dockerfile, false); err != nil {
|
|
| 589 | 589 |
c.Fatal(err) |
| 590 | 590 |
} |
| 591 |
+ out2, _ = dockerCmd(c, "run", name, "ls", "-le", "/file") |
|
| 591 | 592 |
|
| 592 |
- newMTime = regexp.MustCompile(`root.*/file.*\n`).FindString(out2) |
|
| 593 |
- if newMTime == originMTime {
|
|
| 594 |
- c.Fatalf("MTime didn't change:\nOrigin:%s\nNew:%s", originMTime, newMTime)
|
|
| 593 |
+ if out == out2 {
|
|
| 594 |
+ c.Fatalf("MTime didn't change:\nOrigin:%s\nNew:%s", out, out2)
|
|
| 595 | 595 |
} |
| 596 | 596 |
|
| 597 | 597 |
} |
| ... | ... |
@@ -6551,13 +6545,11 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C) |
| 6551 | 6551 |
|
| 6552 | 6552 |
// Test cases in #22036 |
| 6553 | 6553 |
func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) {
|
| 6554 |
- testRequires(c, DaemonIsLinux) |
|
| 6555 |
- |
|
| 6556 | 6554 |
// Command line option labels will always override |
| 6557 | 6555 |
name := "scratchy" |
| 6558 | 6556 |
expected := `{"bar":"from-flag","foo":"from-flag"}`
|
| 6559 | 6557 |
_, err := buildImage(name, |
| 6560 |
- `FROM scratch |
|
| 6558 |
+ `FROM `+minimalBaseImage()+` |
|
| 6561 | 6559 |
LABEL foo=from-dockerfile`, |
| 6562 | 6560 |
true, "--label", "foo=from-flag", "--label", "bar=from-flag") |
| 6563 | 6561 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -6570,7 +6562,7 @@ func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) {
|
| 6570 | 6570 |
name = "from" |
| 6571 | 6571 |
expected = `{"foo":"from-dockerfile"}`
|
| 6572 | 6572 |
_, err = buildImage(name, |
| 6573 |
- `FROM scratch |
|
| 6573 |
+ `FROM `+minimalBaseImage()+` |
|
| 6574 | 6574 |
LABEL foo from-dockerfile`, |
| 6575 | 6575 |
true) |
| 6576 | 6576 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -6599,7 +6591,7 @@ func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) {
|
| 6599 | 6599 |
name = "scratchy2" |
| 6600 | 6600 |
expected = `{"bar":"","foo":""}`
|
| 6601 | 6601 |
_, err = buildImage(name, |
| 6602 |
- `FROM scratch |
|
| 6602 |
+ `FROM `+minimalBaseImage()+` |
|
| 6603 | 6603 |
LABEL foo=from-dockerfile`, |
| 6604 | 6604 |
true, "--label", "foo", "--label", "bar=") |
| 6605 | 6605 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -6629,7 +6621,7 @@ func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) {
|
| 6629 | 6629 |
name = "scratchy" |
| 6630 | 6630 |
expected = `{"bar":"from-flag","foo":"from-flag"}`
|
| 6631 | 6631 |
_, err = buildImage(name, |
| 6632 |
- `FROM scratch`, |
|
| 6632 |
+ `FROM `+minimalBaseImage(), |
|
| 6633 | 6633 |
true, "--label", "foo=from-flag", "--label", "bar=from-flag") |
| 6634 | 6634 |
c.Assert(err, check.IsNil) |
| 6635 | 6635 |
|