From 8fb4ab3d92126cdd85d0907e22d3ef0869037e30 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Sun, 19 May 2019 03:00:32 +0000 Subject: [PATCH] Add integration test for invalid reference This change adds a couple of tests to prevent further regression introduced by https://github.com/containers/skopeo/pull/653 Signed-off-by: Tristan Cacqueray --- integration/check_test.go | 4 ++++ integration/copy_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/integration/check_test.go b/integration/check_test.go index 09102af4..7adb06ec 100644 --- a/integration/check_test.go +++ b/integration/check_test.go @@ -87,3 +87,7 @@ func (s *SkopeoSuite) TestNoNeedAuthToPrivateRegistryV2ImageNotFound(c *check.C) wanted = ".*unauthorized: authentication required.*" c.Assert(string(out), check.Not(check.Matches), "(?s)"+wanted) // (?s) : '.' will also match newlines } + +func (s *SkopeoSuite) TestInspectFailsWhenReferenceIsInvalid(c *check.C) { + assertSkopeoFails(c, `.*Invalid image name.*`, "inspect", "unknown") +} diff --git a/integration/copy_test.go b/integration/copy_test.go index eac12928..29a120b0 100644 --- a/integration/copy_test.go +++ b/integration/copy_test.go @@ -696,3 +696,7 @@ func (s *SkopeoSuite) TestFailureCopySrcWithMirrorAndPrefixUnavailable(c *check. assertSkopeoFails(c, ".*no such host.*", "--registries-conf="+regConfFixture, "copy", "docker://gcr.invalid/wrong/prefix/busybox", "dir:"+dir) } + +func (s *CopySuite) TestCopyFailsWhenReferenceIsInvalid(c *check.C) { + assertSkopeoFails(c, `.*Invalid image name.*`, "copy", "unknown:transport", "unknown:test") +}