From 87dd4085cdbf457fcacadd839bc0bb94a021e0fa Mon Sep 17 00:00:00 2001 From: Tim Hardeck Date: Thu, 4 Jul 2024 13:13:28 +0200 Subject: [PATCH] Adapt integration test to wrapped error message --- cmd/gitcloner/integrationtests/clone_test.go | 2 +- integrationtests/git/git_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/gitcloner/integrationtests/clone_test.go b/cmd/gitcloner/integrationtests/clone_test.go index 14294126..1c36fe7f 100644 --- a/cmd/gitcloner/integrationtests/clone_test.go +++ b/cmd/gitcloner/integrationtests/clone_test.go @@ -130,7 +130,7 @@ var _ = Describe("Applying a git job gets content from git repo", func() { }) It("Fails to clone the repo", func() { - Expect(cloneErr.Error()).To(Equal("authentication required")) + Expect(cloneErr.Error()).To(ContainSubstring("authentication required")) }) }) diff --git a/integrationtests/git/git_test.go b/integrationtests/git/git_test.go index a8269a65..8f1c28ec 100644 --- a/integrationtests/git/git_test.go +++ b/integrationtests/git/git_test.go @@ -89,8 +89,10 @@ func TestLatestCommit_NoAuth(t *testing.T) { t.Run(name, func(t *testing.T) { secretGetter := &secretGetterMock{err: kerrors.NewNotFound(schema.GroupResource{}, "notfound")} latestCommit, err := git.LatestCommit(test.gitjob, secretGetter) - if err != test.expectedErr { - t.Errorf("expecter error is: %v, but got %v", test.expectedErr, err) + if test.expectedErr == nil { + require.NoError(t, err) + } else { + require.Contains(t, err.Error(), test.expectedErr.Error()) } if latestCommit != test.expectedCommit { t.Errorf("latestCommit doesn't match. got %s, expected %s", latestCommit, test.expectedCommit)