fix DockerSchema1RegistrySuite.TestPullFailsWithAlteredLayer

This test was failing if after the busybox image switched to a
single layer.

The test fails because it alters the data of an empty layer and
relies on a side effect of another empty layer not being skipped
on pull to pass.

(The original patch was provided by Tonis Tiigi)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2017-02-17 10:34:33 -08:00
parent 0de867b315
commit 4077614fb3
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 4 additions and 1 deletions

View File

@ -31,7 +31,10 @@ func setupImage(c *check.C) (digest.Digest, error) {
func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
containerName := "busyboxbydigest"
dockerCmd(c, "run", "-e", "digest=1", "--name", containerName, "busybox")
// new file is committed because this layer is used for detecting malicious
// changes. if this was committed as empty layer it would be skipped on pull
// and malicious changes would never be detected.
dockerCmd(c, "run", "-e", "digest=1", "--name", containerName, "busybox", "touch", "anewfile")
// tag the image to upload it to the private registry
repoAndTag := repoName + ":" + tag