Skip to content

Commit 13b7d11

Browse files
committed
Remove Schema1 integration test suite
Signed-off-by: Brian Goff <[email protected]>
1 parent 98fc091 commit 13b7d11

7 files changed

Lines changed: 20 additions & 343 deletions

File tree

Dockerfile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,13 @@ RUN apt-get update && apt-get install -y \
4949
&& make PREFIX=/build/ install-criu
5050

5151
FROM base AS registry
52-
# Install two versions of the registry. The first is an older version that
53-
# only supports schema1 manifests. The second is a newer version that supports
54-
# both. This allows integration-cli tests to cover push/pull with both schema1
55-
# and schema2 manifests.
56-
ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
5752
ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
5853
RUN set -x \
5954
&& export GOPATH="$(mktemp -d)" \
6055
&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
6156
&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
6257
&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
6358
go build -buildmode=pie -o /build/registry-v2 github.com/docker/distribution/cmd/registry \
64-
&& case $(dpkg --print-architecture) in \
65-
amd64|ppc64*|s390x) \
66-
(cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1"); \
67-
GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH"; \
68-
go build -buildmode=pie -o /build/registry-v2-schema1 github.com/docker/distribution/cmd/registry; \
69-
;; \
70-
esac \
7159
&& rm -rf "$GOPATH"
7260

7361

integration-cli/check_test.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -141,39 +141,6 @@ func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
141141
s.ds.TearDownTest(c)
142142
}
143143

144-
func init() {
145-
check.Suite(&DockerSchema1RegistrySuite{
146-
ds: &DockerSuite{},
147-
})
148-
}
149-
150-
type DockerSchema1RegistrySuite struct {
151-
ds *DockerSuite
152-
reg *registry.V2
153-
d *daemon.Daemon
154-
}
155-
156-
func (s *DockerSchema1RegistrySuite) OnTimeout(c *check.C) {
157-
s.d.DumpStackAndQuit()
158-
}
159-
160-
func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
161-
testRequires(c, DaemonIsLinux, RegistryHosting, NotArm64, testEnv.IsLocalDaemon)
162-
s.reg = registry.NewV2(c, registry.Schema1)
163-
s.reg.WaitReady(c)
164-
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
165-
}
166-
167-
func (s *DockerSchema1RegistrySuite) TearDownTest(c *check.C) {
168-
if s.reg != nil {
169-
s.reg.Close()
170-
}
171-
if s.d != nil {
172-
s.d.Stop(c)
173-
}
174-
s.ds.TearDownTest(c)
175-
}
176-
177144
func init() {
178145
check.Suite(&DockerRegistryAuthHtpasswdSuite{
179146
ds: &DockerSuite{},

integration-cli/docker_cli_by_digest_test.go

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6-
"os"
7-
"path/filepath"
86
"regexp"
97
"strings"
108

11-
"github.com/docker/distribution/manifest/schema1"
129
"github.com/docker/distribution/manifest/schema2"
1310
"github.com/docker/docker/api/types"
1411
"github.com/docker/docker/integration-cli/checker"
@@ -80,10 +77,6 @@ func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
8077
testPullByTagDisplaysDigest(c)
8178
}
8279

83-
func (s *DockerSchema1RegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
84-
testPullByTagDisplaysDigest(c)
85-
}
86-
8780
func testPullByDigest(c *check.C) {
8881
testRequires(c, DaemonIsLinux)
8982
pushDigest, err := setupImage(c)
@@ -106,10 +99,6 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
10699
testPullByDigest(c)
107100
}
108101

109-
func (s *DockerSchema1RegistrySuite) TestPullByDigest(c *check.C) {
110-
testPullByDigest(c)
111-
}
112-
113102
func testPullByDigestNoFallback(c *check.C) {
114103
testRequires(c, DaemonIsLinux)
115104
// pull from the registry using the <name>@<digest> reference
@@ -123,10 +112,6 @@ func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
123112
testPullByDigestNoFallback(c)
124113
}
125114

126-
func (s *DockerSchema1RegistrySuite) TestPullByDigestNoFallback(c *check.C) {
127-
testPullByDigestNoFallback(c)
128-
}
129-
130115
func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
131116
pushDigest, err := setupImage(c)
132117
c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
@@ -563,131 +548,3 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
563548
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
564549
c.Assert(out, checker.Contains, expectedErrorMsg)
565550
}
566-
567-
// TestPullFailsWithAlteredManifest tests that a `docker pull` fails when
568-
// we have modified a manifest blob and its digest cannot be verified.
569-
// This is the schema1 version of the test.
570-
func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
571-
testRequires(c, DaemonIsLinux)
572-
manifestDigest, err := setupImage(c)
573-
c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
574-
575-
// Load the target manifest blob.
576-
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest)
577-
578-
var imgManifest schema1.Manifest
579-
err = json.Unmarshal(manifestBlob, &imgManifest)
580-
c.Assert(err, checker.IsNil, check.Commentf("unable to decode image manifest from blob"))
581-
582-
// Change a layer in the manifest.
583-
imgManifest.FSLayers[0] = schema1.FSLayer{
584-
BlobSum: digest.Digest("sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"),
585-
}
586-
587-
// Move the existing data file aside, so that we can replace it with a
588-
// malicious blob of data. NOTE: we defer the returned undo func.
589-
undo := s.reg.TempMoveBlobData(c, manifestDigest)
590-
defer undo()
591-
592-
alteredManifestBlob, err := json.MarshalIndent(imgManifest, "", " ")
593-
c.Assert(err, checker.IsNil, check.Commentf("unable to encode altered image manifest to JSON"))
594-
595-
s.reg.WriteBlobContents(c, manifestDigest, alteredManifestBlob)
596-
597-
// Now try pulling that image by digest. We should get an error about
598-
// digest verification for the manifest digest.
599-
600-
// Pull from the registry using the <name>@<digest> reference.
601-
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
602-
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
603-
c.Assert(exitStatus, checker.Not(check.Equals), 0)
604-
605-
expectedErrorMsg := fmt.Sprintf("image verification failed for digest %s", manifestDigest)
606-
c.Assert(out, checker.Contains, expectedErrorMsg)
607-
}
608-
609-
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when
610-
// we have modified a layer blob and its digest cannot be verified.
611-
// This is the schema2 version of the test.
612-
func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
613-
testRequires(c, DaemonIsLinux)
614-
manifestDigest, err := setupImage(c)
615-
c.Assert(err, checker.IsNil)
616-
617-
// Load the target manifest blob.
618-
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest)
619-
620-
var imgManifest schema2.Manifest
621-
err = json.Unmarshal(manifestBlob, &imgManifest)
622-
c.Assert(err, checker.IsNil)
623-
624-
// Next, get the digest of one of the layers from the manifest.
625-
targetLayerDigest := imgManifest.Layers[0].Digest
626-
627-
// Move the existing data file aside, so that we can replace it with a
628-
// malicious blob of data. NOTE: we defer the returned undo func.
629-
undo := s.reg.TempMoveBlobData(c, targetLayerDigest)
630-
defer undo()
631-
632-
// Now make a fake data blob in this directory.
633-
s.reg.WriteBlobContents(c, targetLayerDigest, []byte("This is not the data you are looking for."))
634-
635-
// Now try pulling that image by digest. We should get an error about
636-
// digest verification for the target layer digest.
637-
638-
// Remove distribution cache to force a re-pull of the blobs
639-
if err := os.RemoveAll(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "image", s.d.StorageDriver(), "distribution")); err != nil {
640-
c.Fatalf("error clearing distribution cache: %v", err)
641-
}
642-
643-
// Pull from the registry using the <name>@<digest> reference.
644-
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
645-
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
646-
c.Assert(exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
647-
648-
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
649-
c.Assert(out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
650-
}
651-
652-
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when
653-
// we have modified a layer blob and its digest cannot be verified.
654-
// This is the schema1 version of the test.
655-
func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
656-
testRequires(c, DaemonIsLinux)
657-
manifestDigest, err := setupImage(c)
658-
c.Assert(err, checker.IsNil)
659-
660-
// Load the target manifest blob.
661-
manifestBlob := s.reg.ReadBlobContents(c, manifestDigest)
662-
663-
var imgManifest schema1.Manifest
664-
err = json.Unmarshal(manifestBlob, &imgManifest)
665-
c.Assert(err, checker.IsNil)
666-
667-
// Next, get the digest of one of the layers from the manifest.
668-
targetLayerDigest := imgManifest.FSLayers[0].BlobSum
669-
670-
// Move the existing data file aside, so that we can replace it with a
671-
// malicious blob of data. NOTE: we defer the returned undo func.
672-
undo := s.reg.TempMoveBlobData(c, targetLayerDigest)
673-
defer undo()
674-
675-
// Now make a fake data blob in this directory.
676-
s.reg.WriteBlobContents(c, targetLayerDigest, []byte("This is not the data you are looking for."))
677-
678-
// Now try pulling that image by digest. We should get an error about
679-
// digest verification for the target layer digest.
680-
681-
// Remove distribution cache to force a re-pull of the blobs
682-
if err := os.RemoveAll(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "image", s.d.StorageDriver(), "distribution")); err != nil {
683-
c.Fatalf("error clearing distribution cache: %v", err)
684-
}
685-
686-
// Pull from the registry using the <name>@<digest> reference.
687-
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
688-
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
689-
c.Assert(exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
690-
691-
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
692-
c.Assert(out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
693-
}

integration-cli/docker_cli_daemon_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"path"
1919
"path/filepath"
2020
"regexp"
21-
"runtime"
2221
"strconv"
2322
"strings"
2423
"sync"
@@ -551,26 +550,6 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) {
551550
}
552551
}
553552

554-
func (s *DockerDaemonSuite) TestDaemonUUIDGeneration(c *check.C) {
555-
dir := "/var/lib/docker"
556-
if runtime.GOOS == "windows" {
557-
dir = filepath.Join(os.Getenv("programdata"), "docker")
558-
}
559-
file := filepath.Join(dir, "engine_uuid")
560-
os.Remove(file)
561-
s.d.Start(c)
562-
s.d.Stop(c)
563-
564-
fi, err := os.Stat(file)
565-
if err != nil {
566-
c.Fatalf("Error opening uuid file")
567-
}
568-
// Test for uuid length
569-
if fi.Size() != 36 {
570-
c.Fatalf("Bad UUID size %d", fi.Size())
571-
}
572-
}
573-
574553
// GH#11320 - verify that the daemon exits on failure properly
575554
// Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means
576555
// to get a daemon init failure; no other tests for -b/--bip conflict are therefore required
@@ -1198,59 +1177,6 @@ func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) {
11981177
}
11991178
}
12001179

1201-
func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) {
1202-
type Config struct {
1203-
Crv string `json:"crv"`
1204-
D string `json:"d"`
1205-
Kid string `json:"kid"`
1206-
Kty string `json:"kty"`
1207-
X string `json:"x"`
1208-
Y string `json:"y"`
1209-
}
1210-
1211-
os.Remove("/etc/docker/key.json")
1212-
s.d.Start(c)
1213-
s.d.Stop(c)
1214-
1215-
config := &Config{}
1216-
bytes, err := ioutil.ReadFile("/etc/docker/key.json")
1217-
if err != nil {
1218-
c.Fatalf("Error reading key.json file: %s", err)
1219-
}
1220-
1221-
// byte[] to Data-Struct
1222-
if err := json.Unmarshal(bytes, &config); err != nil {
1223-
c.Fatalf("Error Unmarshal: %s", err)
1224-
}
1225-
1226-
//replace config.Kid with the fake value
1227-
config.Kid = "VSAJ:FUYR:X3H2:B2VZ:KZ6U:CJD5:K7BX:ZXHY:UZXT:P4FT:MJWG:HRJ4"
1228-
1229-
// NEW Data-Struct to byte[]
1230-
newBytes, err := json.Marshal(&config)
1231-
if err != nil {
1232-
c.Fatalf("Error Marshal: %s", err)
1233-
}
1234-
1235-
// write back
1236-
if err := ioutil.WriteFile("/etc/docker/key.json", newBytes, 0400); err != nil {
1237-
c.Fatalf("Error ioutil.WriteFile: %s", err)
1238-
}
1239-
1240-
defer os.Remove("/etc/docker/key.json")
1241-
1242-
if err := s.d.StartWithError(); err == nil {
1243-
c.Fatalf("It should not be successful to start daemon with wrong key: %v", err)
1244-
}
1245-
1246-
content, err := s.d.ReadLogFile()
1247-
c.Assert(err, checker.IsNil)
1248-
1249-
if !strings.Contains(string(content), "Public Key ID does not match") {
1250-
c.Fatalf("Missing KeyID message from daemon logs: %s", string(content))
1251-
}
1252-
}
1253-
12541180
func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *check.C) {
12551181
s.d.StartWithBusybox(c)
12561182

0 commit comments

Comments
 (0)