mirror of
https://github.com/docker/cli.git
synced 2026-09-26 09:20:58 -04:00
Merge pull request #20703 from riyazdf/notary-v0.2.0-vendor
Vendor in notary v0.2.0 Upstream-commit: e330d0749ce2d137249f290a4d20b0997279dbec Component: engine
This commit is contained in:
@@ -365,7 +365,7 @@ func (s *DockerTrustSuite) TestCreateWhenCertExpired(c *check.C) {
|
||||
|
||||
func (s *DockerTrustSuite) TestTrustedCreateFromBadTrustServer(c *check.C) {
|
||||
repoName := fmt.Sprintf("%v/dockerclievilcreate/trusted:latest", privateRegistryURL)
|
||||
evilLocalConfigDir, err := ioutil.TempDir("", "evil-local-config-dir")
|
||||
evilLocalConfigDir, err := ioutil.TempDir("", "evilcreate-local-config-dir")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
// tag the image and upload it to the private registry
|
||||
@@ -404,12 +404,16 @@ func (s *DockerTrustSuite) TestTrustedCreateFromBadTrustServer(c *check.C) {
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(string(out), checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push:\n%s", out))
|
||||
|
||||
// Now, try creating with the original client from this new trust server. This should fail.
|
||||
// Now, try creating with the original client from this new trust server. This should fallback to our cached timestamp and metadata.
|
||||
createCmd = exec.Command(dockerBinary, "create", repoName)
|
||||
s.trustedCmd(createCmd)
|
||||
out, _, err = runCommandWithOutput(createCmd)
|
||||
c.Assert(err, check.Not(check.IsNil))
|
||||
c.Assert(string(out), checker.Contains, "valid signatures did not meet threshold", check.Commentf("Missing expected output on trusted push:\n%s", out))
|
||||
if err != nil {
|
||||
c.Fatalf("Error falling back to cached trust data: %s\n%s", err, out)
|
||||
}
|
||||
if !strings.Contains(string(out), "Error while downloading remote metadata, using cached timestamp") {
|
||||
c.Fatalf("Missing expected output on trusted create:\n%s", out)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -135,13 +135,16 @@ func (s *DockerTrustSuite) TestTrustedPullFromBadTrustServer(c *check.C) {
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
c.Assert(string(out), checker.Contains, "Signing and pushing trust metadata", check.Commentf(out))
|
||||
|
||||
// Now, try pulling with the original client from this new trust server. This should fail.
|
||||
// Now, try pulling with the original client from this new trust server. This should fall back to cached metadata.
|
||||
pullCmd = exec.Command(dockerBinary, "pull", repoName)
|
||||
s.trustedCmd(pullCmd)
|
||||
out, _, err = runCommandWithOutput(pullCmd)
|
||||
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(string(out), checker.Contains, "valid signatures did not meet threshold", check.Commentf(out))
|
||||
if err != nil {
|
||||
c.Fatalf("Error falling back to cached trust data: %s\n%s", err, out)
|
||||
}
|
||||
if !strings.Contains(string(out), "Error while downloading remote metadata, using cached timestamp") {
|
||||
c.Fatalf("Missing expected output on trusted pull:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerTrustSuite) TestTrustedPullWithExpiredSnapshot(c *check.C) {
|
||||
|
||||
@@ -3260,7 +3260,7 @@ func (s *DockerTrustSuite) TestTrustedRunFromBadTrustServer(c *check.C) {
|
||||
// Windows does not support this functionality
|
||||
testRequires(c, DaemonIsLinux)
|
||||
repoName := fmt.Sprintf("%v/dockerclievilrun/trusted:latest", privateRegistryURL)
|
||||
evilLocalConfigDir, err := ioutil.TempDir("", "evil-local-config-dir")
|
||||
evilLocalConfigDir, err := ioutil.TempDir("", "evilrun-local-config-dir")
|
||||
if err != nil {
|
||||
c.Fatalf("Failed to create local temp dir")
|
||||
}
|
||||
@@ -3316,15 +3316,15 @@ func (s *DockerTrustSuite) TestTrustedRunFromBadTrustServer(c *check.C) {
|
||||
c.Fatalf("Missing expected output on trusted push:\n%s", out)
|
||||
}
|
||||
|
||||
// Now, try running with the original client from this new trust server. This should fail.
|
||||
// Now, try running with the original client from this new trust server. This should fallback to our cached timestamp and metadata.
|
||||
runCmd = exec.Command(dockerBinary, "run", repoName)
|
||||
s.trustedCmd(runCmd)
|
||||
out, _, err = runCommandWithOutput(runCmd)
|
||||
if err == nil {
|
||||
c.Fatalf("Expected to fail on this run due to different remote data: %s\n%s", err, out)
|
||||
}
|
||||
|
||||
if !strings.Contains(string(out), "valid signatures did not meet threshold") {
|
||||
if err != nil {
|
||||
c.Fatalf("Error falling back to cached trust data: %s\n%s", err, out)
|
||||
}
|
||||
if !strings.Contains(string(out), "Error while downloading remote metadata, using cached timestamp") {
|
||||
c.Fatalf("Missing expected output on trusted push:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ func (s *DockerTrustSuite) setupDelegations(c *check.C, repoName, pwd string) {
|
||||
if err != nil {
|
||||
c.Fatalf("Error creating delegation key: %s\n", err)
|
||||
}
|
||||
err = nRepo.AddDelegation("targets/releases", 1, []data.PublicKey{delgKey}, []string{""})
|
||||
err = nRepo.AddDelegation("targets/releases", []data.PublicKey{delgKey}, []string{""})
|
||||
if err != nil {
|
||||
c.Fatalf("Error creating delegation: %s\n", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user