From 9bd536589dfbd27259a5879ec7c97e332bb8e5b5 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 18 Apr 2018 17:02:21 +0200 Subject: [PATCH] =?UTF-8?q?Make=20testing=20helpers=20as=20such=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That way, those lines won't be reported in the failure. Signed-off-by: Vincent Demeester Upstream-commit: b29844f8ca57eeb0b9e3722fb4beeb28f51b71a6 Component: cli --- components/cli/e2e/internal/fixtures/fixtures.go | 4 ++++ components/cli/internal/test/output/output.go | 1 + 2 files changed, 5 insertions(+) diff --git a/components/cli/e2e/internal/fixtures/fixtures.go b/components/cli/e2e/internal/fixtures/fixtures.go index e68162cdd4..528e07b955 100644 --- a/components/cli/e2e/internal/fixtures/fixtures.go +++ b/components/cli/e2e/internal/fixtures/fixtures.go @@ -24,6 +24,7 @@ const ( //SetupConfigFile creates a config.json file for testing func SetupConfigFile(t *testing.T) fs.Dir { + t.Helper() dir := fs.NewDir(t, "trust_test", fs.WithMode(0700), fs.WithFile("config.json", ` { "auths": { @@ -97,12 +98,14 @@ func WithNotaryServer(notaryURL string) func(*icmd.Cmd) { // CreateMaskedTrustedRemoteImage creates a remote image that is signed with // content trust, then pushes a different untrusted image at the same tag. func CreateMaskedTrustedRemoteImage(t *testing.T, registryPrefix, repo, tag string) string { + t.Helper() image := createTrustedRemoteImage(t, registryPrefix, repo, tag) createNamedUnsignedImageFromBusyBox(t, image) return image } func createTrustedRemoteImage(t *testing.T, registryPrefix, repo, tag string) string { + t.Helper() image := fmt.Sprintf("%s/%s:%s", registryPrefix, repo, tag) icmd.RunCommand("docker", "image", "pull", AlpineImage).Assert(t, icmd.Success) icmd.RunCommand("docker", "image", "tag", AlpineImage, image).Assert(t, icmd.Success) @@ -115,6 +118,7 @@ func createTrustedRemoteImage(t *testing.T, registryPrefix, repo, tag string) st } func createNamedUnsignedImageFromBusyBox(t *testing.T, image string) { + t.Helper() icmd.RunCommand("docker", "image", "pull", BusyboxImage).Assert(t, icmd.Success) icmd.RunCommand("docker", "image", "tag", BusyboxImage, image).Assert(t, icmd.Success) icmd.RunCommand("docker", "image", "push", image).Assert(t, icmd.Success) diff --git a/components/cli/internal/test/output/output.go b/components/cli/internal/test/output/output.go index 075b04c4c0..aa1c5ee2be 100644 --- a/components/cli/internal/test/output/output.go +++ b/components/cli/internal/test/output/output.go @@ -9,6 +9,7 @@ import ( // Assert checks wether the output contains the specified lines func Assert(t *testing.T, actual string, expectedLines map[int]func(string) error) { + t.Helper() for i, line := range strings.Split(actual, "\n") { cmp, ok := expectedLines[i] if !ok {