Merge pull request #46561 from vvoland/c8d-integrationcli-skipsome

c8d: Adjust some integration-cli tests
This commit is contained in:
Sebastiaan van Stijn 2023-09-28 18:46:50 +02:00 committed by GitHub
commit c4f55b53b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ import (
"github.com/opencontainers/go-digest"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/skip"
)
var (
@ -115,7 +116,13 @@ func testPullByDigestNoFallback(c *testing.T) {
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
out, _, err := dockerCmdWithError("pull", imageReference)
assert.Assert(c, err != nil, "expected non-zero exit status and correct error message when pulling non-existing image")
assert.Assert(c, strings.Contains(out, fmt.Sprintf("manifest for %s not found", imageReference)), "expected non-zero exit status and correct error message when pulling non-existing image")
expectedMsg := fmt.Sprintf("manifest for %s not found", imageReference)
if testEnv.UsingSnapshotter() {
expectedMsg = fmt.Sprintf("%s: not found", imageReference)
}
assert.Check(c, is.Contains(out, expectedMsg), "expected non-zero exit status and correct error message when pulling non-existing image")
}
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *testing.T) {
@ -555,8 +562,12 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) {
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
assert.Assert(c, exitStatus != 0)
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
assert.Assert(c, is.Contains(out, expectedErrorMsg))
if testEnv.UsingSnapshotter() {
assert.Assert(c, is.Contains(out, "unexpected commit digest"))
assert.Assert(c, is.Contains(out, "expected "+manifestDigest))
} else {
assert.Assert(c, is.Contains(out, fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)))
}
}
// TestPullFailsWithAlteredManifest tests that a `docker pull` fails when
@ -606,6 +617,8 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing
// This is the schema2 version of the test.
func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
testRequires(c, DaemonIsLinux)
skip.If(c, testEnv.UsingSnapshotter(), "Faked layer is already in the content store, so it won't be fetched from the repository at all.")
manifestDigest, err := setupImage(c)
assert.Assert(c, err == nil)