mirror of
https://github.com/containers/skopeo.git
synced 2025-08-14 04:36:10 +00:00
Update tests for changed error texts
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
ae50898b8a
commit
955a59c864
@ -54,19 +54,19 @@ func (s *SkopeoSuite) TestVersion(c *check.C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SkopeoSuite) TestCanAuthToPrivateRegistryV2WithoutDockerCfg(c *check.C) {
|
func (s *SkopeoSuite) TestCanAuthToPrivateRegistryV2WithoutDockerCfg(c *check.C) {
|
||||||
assertSkopeoFails(c, ".*manifest unknown: manifest unknown.*",
|
assertSkopeoFails(c, ".*manifest unknown.*",
|
||||||
"--tls-verify=false", "inspect", "--creds="+s.regV2WithAuth.username+":"+s.regV2WithAuth.password, fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url))
|
"--tls-verify=false", "inspect", "--creds="+s.regV2WithAuth.username+":"+s.regV2WithAuth.password, fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SkopeoSuite) TestNeedAuthToPrivateRegistryV2WithoutDockerCfg(c *check.C) {
|
func (s *SkopeoSuite) TestNeedAuthToPrivateRegistryV2WithoutDockerCfg(c *check.C) {
|
||||||
assertSkopeoFails(c, ".*unauthorized: authentication required.*",
|
assertSkopeoFails(c, ".*authentication required.*",
|
||||||
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url))
|
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SkopeoSuite) TestCertDirInsteadOfCertPath(c *check.C) {
|
func (s *SkopeoSuite) TestCertDirInsteadOfCertPath(c *check.C) {
|
||||||
assertSkopeoFails(c, ".*unknown flag: --cert-path.*",
|
assertSkopeoFails(c, ".*unknown flag: --cert-path.*",
|
||||||
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url), "--cert-path=/")
|
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url), "--cert-path=/")
|
||||||
assertSkopeoFails(c, ".*unauthorized: authentication required.*",
|
assertSkopeoFails(c, ".*authentication required.*",
|
||||||
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url), "--cert-dir=/etc/docker/certs.d/")
|
"--tls-verify=false", "inspect", fmt.Sprintf("docker://%s/busybox:latest", s.regV2WithAuth.url), "--cert-dir=/etc/docker/certs.d/")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +106,6 @@ func (s *SkopeoSuite) TestCopyWithLocalAuth(c *check.C) {
|
|||||||
assertSkopeoSucceeds(c, fmt.Sprintf("^Removed login credentials for %s\n$", s.regV2WithAuth.url),
|
assertSkopeoSucceeds(c, fmt.Sprintf("^Removed login credentials for %s\n$", s.regV2WithAuth.url),
|
||||||
"logout", s.regV2WithAuth.url)
|
"logout", s.regV2WithAuth.url)
|
||||||
// inspect from private registry should fail after logout
|
// inspect from private registry should fail after logout
|
||||||
assertSkopeoFails(c, ".*unauthorized: authentication required.*",
|
assertSkopeoFails(c, ".*authentication required.*",
|
||||||
"inspect", "--tls-verify=false", imageName)
|
"inspect", "--tls-verify=false", imageName)
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1036,7 @@ func (s *CopySuite) TestCopyVerifyingMirroredSignatures(c *check.C) {
|
|||||||
assertSkopeoSucceeds(c, "", "--policy", policy, "--registries.d", registriesDir, "--registries-conf", "fixtures/registries.conf", "copy", "--src-tls-verify=false", regPrefix+"remap:remapped", dirDest)
|
assertSkopeoSucceeds(c, "", "--policy", policy, "--registries.d", registriesDir, "--registries-conf", "fixtures/registries.conf", "copy", "--src-tls-verify=false", regPrefix+"remap:remapped", dirDest)
|
||||||
// To be extra clear about the semantics, verify that the signedPrefix (primary) location never exists
|
// To be extra clear about the semantics, verify that the signedPrefix (primary) location never exists
|
||||||
// and only the remapped prefix (mirror) is accessed.
|
// and only the remapped prefix (mirror) is accessed.
|
||||||
assertSkopeoFails(c, ".*initializing source docker://localhost:5006/myns/mirroring-primary:remapped:.*manifest unknown: manifest unknown.*",
|
assertSkopeoFails(c, ".*initializing source docker://localhost:5006/myns/mirroring-primary:remapped:.*manifest unknown.*",
|
||||||
"--policy", policy, "--registries.d", registriesDir, "--registries-conf", "fixtures/registries.conf", "copy", "--src-tls-verify=false", regPrefix+"primary:remapped", dirDest)
|
"--policy", policy, "--registries.d", registriesDir, "--registries-conf", "fixtures/registries.conf", "copy", "--src-tls-verify=false", regPrefix+"primary:remapped", dirDest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,11 +544,11 @@ func (s *SyncSuite) TestFailsWithDockerSourceNoRegistry(c *check.C) {
|
|||||||
tmpDir := c.MkDir()
|
tmpDir := c.MkDir()
|
||||||
|
|
||||||
//untagged
|
//untagged
|
||||||
assertSkopeoFails(c, ".*invalid status code from registry 404.*",
|
assertSkopeoFails(c, ".*StatusCode: 404.*",
|
||||||
"sync", "--scoped", "--src", "docker", "--dest", "dir", regURL, tmpDir)
|
"sync", "--scoped", "--src", "docker", "--dest", "dir", regURL, tmpDir)
|
||||||
|
|
||||||
//tagged
|
//tagged
|
||||||
assertSkopeoFails(c, ".*invalid status code from registry 404.*",
|
assertSkopeoFails(c, ".*StatusCode: 404.*",
|
||||||
"sync", "--scoped", "--src", "docker", "--dest", "dir", regURL+":thetag", tmpDir)
|
"sync", "--scoped", "--src", "docker", "--dest", "dir", regURL+":thetag", tmpDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ func (s *SyncSuite) TestFailsWithDockerSourceUnauthorized(c *check.C) {
|
|||||||
"sync", "--scoped", "--src", "docker", "--dest", "dir", repo, tmpDir)
|
"sync", "--scoped", "--src", "docker", "--dest", "dir", repo, tmpDir)
|
||||||
|
|
||||||
//tagged
|
//tagged
|
||||||
assertSkopeoFails(c, ".*unauthorized: authentication required.*",
|
assertSkopeoFails(c, ".*requested access to the resource is denied.*",
|
||||||
"sync", "--scoped", "--src", "docker", "--dest", "dir", repo+":thetag", tmpDir)
|
"sync", "--scoped", "--src", "docker", "--dest", "dir", repo+":thetag", tmpDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ func (s *SyncSuite) TestFailsWithDockerSourceNotExisting(c *check.C) {
|
|||||||
tmpDir := c.MkDir()
|
tmpDir := c.MkDir()
|
||||||
|
|
||||||
//untagged
|
//untagged
|
||||||
assertSkopeoFails(c, ".*invalid status code from registry 404.*",
|
assertSkopeoFails(c, ".*repository name not known to registry.*",
|
||||||
"sync", "--scoped", "--src-tls-verify=false", "--src", "docker", "--dest", "dir", repo, tmpDir)
|
"sync", "--scoped", "--src-tls-verify=false", "--src", "docker", "--dest", "dir", repo, tmpDir)
|
||||||
|
|
||||||
//tagged
|
//tagged
|
||||||
|
@ -24,22 +24,22 @@ function setup() {
|
|||||||
@test "auth: credentials on command line" {
|
@test "auth: credentials on command line" {
|
||||||
# No creds
|
# No creds
|
||||||
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/nonesuch
|
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/nonesuch
|
||||||
expect_output --substring "unauthorized: authentication required"
|
expect_output --substring "authentication required"
|
||||||
|
|
||||||
# Wrong user
|
# Wrong user
|
||||||
run_skopeo 1 inspect --tls-verify=false --creds=baduser:badpassword \
|
run_skopeo 1 inspect --tls-verify=false --creds=baduser:badpassword \
|
||||||
docker://localhost:5000/nonesuch
|
docker://localhost:5000/nonesuch
|
||||||
expect_output --substring "unauthorized: authentication required"
|
expect_output --substring "authentication required"
|
||||||
|
|
||||||
# Wrong password
|
# Wrong password
|
||||||
run_skopeo 1 inspect --tls-verify=false --creds=$testuser:badpassword \
|
run_skopeo 1 inspect --tls-verify=false --creds=$testuser:badpassword \
|
||||||
docker://localhost:5000/nonesuch
|
docker://localhost:5000/nonesuch
|
||||||
expect_output --substring "unauthorized: authentication required"
|
expect_output --substring "authentication required"
|
||||||
|
|
||||||
# Correct creds, but no such image
|
# Correct creds, but no such image
|
||||||
run_skopeo 1 inspect --tls-verify=false --creds=$testuser:$testpassword \
|
run_skopeo 1 inspect --tls-verify=false --creds=$testuser:$testpassword \
|
||||||
docker://localhost:5000/nonesuch
|
docker://localhost:5000/nonesuch
|
||||||
expect_output --substring "manifest unknown: manifest unknown"
|
expect_output --substring "manifest unknown"
|
||||||
|
|
||||||
# These should pass
|
# These should pass
|
||||||
run_skopeo copy --dest-tls-verify=false --dcreds=$testuser:$testpassword \
|
run_skopeo copy --dest-tls-verify=false --dcreds=$testuser:$testpassword \
|
||||||
@ -64,7 +64,7 @@ function setup() {
|
|||||||
podman logout localhost:5000
|
podman logout localhost:5000
|
||||||
|
|
||||||
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/busybox:mine
|
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/busybox:mine
|
||||||
expect_output --substring "unauthorized: authentication required"
|
expect_output --substring "authentication required"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "auth: copy with --src-creds and --dest-creds" {
|
@test "auth: copy with --src-creds and --dest-creds" {
|
||||||
@ -94,7 +94,7 @@ function setup() {
|
|||||||
|
|
||||||
# inspect without authfile: should fail
|
# inspect without authfile: should fail
|
||||||
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/busybox:mine
|
run_skopeo 1 inspect --tls-verify=false docker://localhost:5000/busybox:mine
|
||||||
expect_output --substring "unauthorized: authentication required"
|
expect_output --substring "authentication required"
|
||||||
|
|
||||||
# inspect with authfile: should work
|
# inspect with authfile: should work
|
||||||
run_skopeo inspect --tls-verify=false --authfile $TESTDIR/test.auth docker://localhost:5000/busybox:mine
|
run_skopeo inspect --tls-verify=false --authfile $TESTDIR/test.auth docker://localhost:5000/busybox:mine
|
||||||
|
Loading…
Reference in New Issue
Block a user