Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -49,11 +49,6 @@ RUN apt-get update && apt-get install -y \ |
| 49 | 49 |
&& make PREFIX=/build/ install-criu |
| 50 | 50 |
|
| 51 | 51 |
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 |
|
| 57 | 52 |
ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 |
| 58 | 53 |
RUN set -x \ |
| 59 | 54 |
&& export GOPATH="$(mktemp -d)" \ |
| ... | ... |
@@ -61,13 +56,6 @@ RUN set -x \ |
| 61 | 61 |
&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ |
| 62 | 62 |
&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ |
| 63 | 63 |
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 \ |
|
| 71 | 64 |
&& rm -rf "$GOPATH" |
| 72 | 65 |
|
| 73 | 66 |
|
| ... | ... |
@@ -142,39 +142,6 @@ func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
|
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 | 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 |
- |
|
| 177 |
-func init() {
|
|
| 178 | 145 |
check.Suite(&DockerRegistryAuthHtpasswdSuite{
|
| 179 | 146 |
ds: &DockerSuite{},
|
| 180 | 147 |
}) |
| ... | ... |
@@ -3,12 +3,9 @@ package main |
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
"fmt" |
| 6 |
- "os" |
|
| 7 |
- "path/filepath" |
|
| 8 | 6 |
"regexp" |
| 9 | 7 |
"strings" |
| 10 | 8 |
|
| 11 |
- "github.com/docker/distribution/manifest/schema1" |
|
| 12 | 9 |
"github.com/docker/distribution/manifest/schema2" |
| 13 | 10 |
"github.com/docker/docker/api/types" |
| 14 | 11 |
"github.com/docker/docker/integration-cli/checker" |
| ... | ... |
@@ -80,10 +77,6 @@ func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
|
| 80 | 80 |
testPullByTagDisplaysDigest(c) |
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 |
-func (s *DockerSchema1RegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
|
|
| 84 |
- testPullByTagDisplaysDigest(c) |
|
| 85 |
-} |
|
| 86 |
- |
|
| 87 | 83 |
func testPullByDigest(c *check.C) {
|
| 88 | 84 |
testRequires(c, DaemonIsLinux) |
| 89 | 85 |
pushDigest, err := setupImage(c) |
| ... | ... |
@@ -106,10 +99,6 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
|
| 106 | 106 |
testPullByDigest(c) |
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 |
-func (s *DockerSchema1RegistrySuite) TestPullByDigest(c *check.C) {
|
|
| 110 |
- testPullByDigest(c) |
|
| 111 |
-} |
|
| 112 |
- |
|
| 113 | 109 |
func testPullByDigestNoFallback(c *check.C) {
|
| 114 | 110 |
testRequires(c, DaemonIsLinux) |
| 115 | 111 |
// pull from the registry using the <name>@<digest> reference |
| ... | ... |
@@ -123,10 +112,6 @@ func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
|
| 123 | 123 |
testPullByDigestNoFallback(c) |
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 |
-func (s *DockerSchema1RegistrySuite) TestPullByDigestNoFallback(c *check.C) {
|
|
| 127 |
- testPullByDigestNoFallback(c) |
|
| 128 |
-} |
|
| 129 |
- |
|
| 130 | 126 |
func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
|
| 131 | 127 |
pushDigest, err := setupImage(c) |
| 132 | 128 |
c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
|
| ... | ... |
@@ -563,131 +548,3 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
|
| 563 | 563 |
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
|
| 564 | 564 |
c.Assert(out, checker.Contains, expectedErrorMsg) |
| 565 | 565 |
} |
| 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 |
-} |
| ... | ... |
@@ -18,7 +18,6 @@ import ( |
| 18 | 18 |
"path" |
| 19 | 19 |
"path/filepath" |
| 20 | 20 |
"regexp" |
| 21 |
- "runtime" |
|
| 22 | 21 |
"strconv" |
| 23 | 22 |
"strings" |
| 24 | 23 |
"sync" |
| ... | ... |
@@ -551,26 +550,6 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) {
|
| 551 | 551 |
} |
| 552 | 552 |
} |
| 553 | 553 |
|
| 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 |
- |
|
| 574 | 554 |
// GH#11320 - verify that the daemon exits on failure properly |
| 575 | 555 |
// Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means
|
| 576 | 556 |
// 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) {
|
| 1198 | 1198 |
} |
| 1199 | 1199 |
} |
| 1200 | 1200 |
|
| 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 |
- |
|
| 1254 | 1201 |
func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *check.C) {
|
| 1255 | 1202 |
s.d.StartWithBusybox(c) |
| 1256 | 1203 |
|
| ... | ... |
@@ -55,10 +55,6 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
|
| 55 | 55 |
testPullImageWithAliases(c) |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
-func (s *DockerSchema1RegistrySuite) TestPullImageWithAliases(c *check.C) {
|
|
| 59 |
- testPullImageWithAliases(c) |
|
| 60 |
-} |
|
| 61 |
- |
|
| 62 | 58 |
// testConcurrentPullWholeRepo pulls the same repo concurrently. |
| 63 | 59 |
func testConcurrentPullWholeRepo(c *check.C) {
|
| 64 | 60 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| ... | ... |
@@ -111,10 +107,6 @@ func (s *DockerRegistrySuite) testConcurrentPullWholeRepo(c *check.C) {
|
| 111 | 111 |
testConcurrentPullWholeRepo(c) |
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 |
-func (s *DockerSchema1RegistrySuite) testConcurrentPullWholeRepo(c *check.C) {
|
|
| 115 |
- testConcurrentPullWholeRepo(c) |
|
| 116 |
-} |
|
| 117 |
- |
|
| 118 | 114 |
// testConcurrentFailingPull tries a concurrent pull that doesn't succeed. |
| 119 | 115 |
func testConcurrentFailingPull(c *check.C) {
|
| 120 | 116 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| ... | ... |
@@ -142,10 +134,6 @@ func (s *DockerRegistrySuite) testConcurrentFailingPull(c *check.C) {
|
| 142 | 142 |
testConcurrentFailingPull(c) |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 |
-func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *check.C) {
|
|
| 146 |
- testConcurrentFailingPull(c) |
|
| 147 |
-} |
|
| 148 |
- |
|
| 149 | 145 |
// testConcurrentPullMultipleTags pulls multiple tags from the same repo |
| 150 | 146 |
// concurrently. |
| 151 | 147 |
func testConcurrentPullMultipleTags(c *check.C) {
|
| ... | ... |
@@ -198,10 +186,6 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
|
| 198 | 198 |
testConcurrentPullMultipleTags(c) |
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 |
-func (s *DockerSchema1RegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
|
|
| 202 |
- testConcurrentPullMultipleTags(c) |
|
| 203 |
-} |
|
| 204 |
- |
|
| 205 | 201 |
// testPullIDStability verifies that pushing an image and pulling it back |
| 206 | 202 |
// preserves the image ID. |
| 207 | 203 |
func testPullIDStability(c *check.C) {
|
| ... | ... |
@@ -259,10 +243,6 @@ func (s *DockerRegistrySuite) TestPullIDStability(c *check.C) {
|
| 259 | 259 |
testPullIDStability(c) |
| 260 | 260 |
} |
| 261 | 261 |
|
| 262 |
-func (s *DockerSchema1RegistrySuite) TestPullIDStability(c *check.C) {
|
|
| 263 |
- testPullIDStability(c) |
|
| 264 |
-} |
|
| 265 |
- |
|
| 266 | 262 |
// #21213 |
| 267 | 263 |
func testPullNoLayers(c *check.C) {
|
| 268 | 264 |
repoName := fmt.Sprintf("%v/dockercli/scratch", privateRegistryURL)
|
| ... | ... |
@@ -279,10 +259,6 @@ func (s *DockerRegistrySuite) TestPullNoLayers(c *check.C) {
|
| 279 | 279 |
testPullNoLayers(c) |
| 280 | 280 |
} |
| 281 | 281 |
|
| 282 |
-func (s *DockerSchema1RegistrySuite) TestPullNoLayers(c *check.C) {
|
|
| 283 |
- testPullNoLayers(c) |
|
| 284 |
-} |
|
| 285 |
- |
|
| 286 | 282 |
func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
|
| 287 | 283 |
testRequires(c, NotArm) |
| 288 | 284 |
pushDigest, err := setupImage(c) |
| ... | ... |
@@ -30,10 +30,6 @@ func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) {
|
| 30 | 30 |
testPushBusyboxImage(c) |
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
-func (s *DockerSchema1RegistrySuite) TestPushBusyboxImage(c *check.C) {
|
|
| 34 |
- testPushBusyboxImage(c) |
|
| 35 |
-} |
|
| 36 |
- |
|
| 37 | 33 |
// pushing an image without a prefix should throw an error |
| 38 | 34 |
func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) {
|
| 39 | 35 |
out, _, err := dockerCmdWithError("push", "busybox")
|
| ... | ... |
@@ -53,10 +49,6 @@ func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) {
|
| 53 | 53 |
testPushUntagged(c) |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 |
-func (s *DockerSchema1RegistrySuite) TestPushUntagged(c *check.C) {
|
|
| 57 |
- testPushUntagged(c) |
|
| 58 |
-} |
|
| 59 |
- |
|
| 60 | 56 |
func testPushBadTag(c *check.C) {
|
| 61 | 57 |
repoName := fmt.Sprintf("%v/dockercli/busybox:latest", privateRegistryURL)
|
| 62 | 58 |
expected := "does not exist" |
| ... | ... |
@@ -70,10 +62,6 @@ func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) {
|
| 70 | 70 |
testPushBadTag(c) |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
-func (s *DockerSchema1RegistrySuite) TestPushBadTag(c *check.C) {
|
|
| 74 |
- testPushBadTag(c) |
|
| 75 |
-} |
|
| 76 |
- |
|
| 77 | 73 |
func testPushMultipleTags(c *check.C) {
|
| 78 | 74 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 79 | 75 |
repoTag1 := fmt.Sprintf("%v/dockercli/busybox:t1", privateRegistryURL)
|
| ... | ... |
@@ -115,10 +103,6 @@ func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) {
|
| 115 | 115 |
testPushMultipleTags(c) |
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 |
-func (s *DockerSchema1RegistrySuite) TestPushMultipleTags(c *check.C) {
|
|
| 119 |
- testPushMultipleTags(c) |
|
| 120 |
-} |
|
| 121 |
- |
|
| 122 | 118 |
func testPushEmptyLayer(c *check.C) {
|
| 123 | 119 |
repoName := fmt.Sprintf("%v/dockercli/emptylayer", privateRegistryURL)
|
| 124 | 120 |
emptyTarball, err := ioutil.TempFile("", "empty_tarball")
|
| ... | ... |
@@ -146,10 +130,6 @@ func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) {
|
| 146 | 146 |
testPushEmptyLayer(c) |
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 |
-func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *check.C) {
|
|
| 150 |
- testPushEmptyLayer(c) |
|
| 151 |
-} |
|
| 152 |
- |
|
| 153 | 149 |
// testConcurrentPush pushes multiple tags to the same repo |
| 154 | 150 |
// concurrently. |
| 155 | 151 |
func testConcurrentPush(c *check.C) {
|
| ... | ... |
@@ -200,10 +180,6 @@ func (s *DockerRegistrySuite) TestConcurrentPush(c *check.C) {
|
| 200 | 200 |
testConcurrentPush(c) |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 |
-func (s *DockerSchema1RegistrySuite) TestConcurrentPush(c *check.C) {
|
|
| 204 |
- testConcurrentPush(c) |
|
| 205 |
-} |
|
| 206 |
- |
|
| 207 | 203 |
func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) {
|
| 208 | 204 |
sourceRepoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 209 | 205 |
// tag the image to upload it to the private registry |
| ... | ... |
@@ -245,39 +221,6 @@ func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) {
|
| 245 | 245 |
c.Assert(out4, check.Equals, "hello world") |
| 246 | 246 |
} |
| 247 | 247 |
|
| 248 |
-func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c *check.C) {
|
|
| 249 |
- sourceRepoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
|
| 250 |
- // tag the image to upload it to the private registry |
|
| 251 |
- dockerCmd(c, "tag", "busybox", sourceRepoName) |
|
| 252 |
- // push the image to the registry |
|
| 253 |
- out1, _, err := dockerCmdWithError("push", sourceRepoName)
|
|
| 254 |
- c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out1))
|
|
| 255 |
- // ensure that none of the layers were mounted from another repository during push |
|
| 256 |
- c.Assert(strings.Contains(out1, "Mounted from"), check.Equals, false) |
|
| 257 |
- |
|
| 258 |
- digest1 := reference.DigestRegexp.FindString(out1) |
|
| 259 |
- c.Assert(len(digest1), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
|
| 260 |
- |
|
| 261 |
- destRepoName := fmt.Sprintf("%v/dockercli/crossrepopush", privateRegistryURL)
|
|
| 262 |
- // retag the image to upload the same layers to another repo in the same registry |
|
| 263 |
- dockerCmd(c, "tag", "busybox", destRepoName) |
|
| 264 |
- // push the image to the registry |
|
| 265 |
- out2, _, err := dockerCmdWithError("push", destRepoName)
|
|
| 266 |
- c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out2))
|
|
| 267 |
- // schema1 registry should not support cross-repo layer mounts, so ensure that this does not happen |
|
| 268 |
- c.Assert(strings.Contains(out2, "Mounted from"), check.Equals, false) |
|
| 269 |
- |
|
| 270 |
- digest2 := reference.DigestRegexp.FindString(out2) |
|
| 271 |
- c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
|
|
| 272 |
- c.Assert(digest1, check.Not(check.Equals), digest2) |
|
| 273 |
- |
|
| 274 |
- // ensure that we can pull and run the second pushed repository |
|
| 275 |
- dockerCmd(c, "rmi", destRepoName) |
|
| 276 |
- dockerCmd(c, "pull", destRepoName) |
|
| 277 |
- out3, _ := dockerCmd(c, "run", destRepoName, "echo", "-n", "hello world") |
|
| 278 |
- c.Assert(out3, check.Equals, "hello world") |
|
| 279 |
-} |
|
| 280 |
- |
|
| 281 | 248 |
func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.C) {
|
| 282 | 249 |
repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
|
| 283 | 250 |
dockerCmd(c, "tag", "busybox", repoName) |
| 284 | 251 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 0 |
+package system |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "context" |
|
| 4 |
+ "testing" |
|
| 5 |
+ |
|
| 6 |
+ "github.com/pborman/uuid" |
|
| 7 |
+ "gotest.tools/assert" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+func TestUUIDGeneration(t *testing.T) {
|
|
| 11 |
+ defer setupTest(t)() |
|
| 12 |
+ |
|
| 13 |
+ c := testEnv.APIClient() |
|
| 14 |
+ info, err := c.Info(context.Background()) |
|
| 15 |
+ assert.NilError(t, err) |
|
| 16 |
+ |
|
| 17 |
+ id := uuid.Parse(info.ID) |
|
| 18 |
+ assert.Equal(t, id != nil, true) |
|
| 19 |
+} |