From 090c10dcb835a6cfb7f598c4e69edba00d6cb3a5 Mon Sep 17 00:00:00 2001 From: Joshua Novick Date: Wed, 14 Aug 2024 02:04:53 +0300 Subject: [PATCH] Fix git tests for ShallowFetch instead of Fetch Signed-off-by: Joshua Novick --- pkg/argocd/update_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/argocd/update_test.go b/pkg/argocd/update_test.go index 7896a992..e67b756f 100644 --- a/pkg/argocd/update_test.go +++ b/pkg/argocd/update_test.go @@ -3009,7 +3009,7 @@ replacements: [] app := app.DeepCopy() gitMock := &gitmock.Client{} gitMock.On("Init").Return(nil) - gitMock.On("Fetch", mock.Anything).Return(nil) + gitMock.On("ShallowFetch", mock.Anything, 1).Return(nil) gitMock.On("Checkout", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { args.Assert(t, "mydefaultbranch", false) }).Return(nil) @@ -3035,7 +3035,7 @@ replacements: [] t.Run("Cannot init", func(t *testing.T) { gitMock := &gitmock.Client{} gitMock.On("Init").Return(fmt.Errorf("cannot init")) - gitMock.On("Fetch", mock.Anything).Return(nil) + gitMock.On("ShallowFetch", mock.Anything, 1).Return(nil) gitMock.On("Checkout", mock.Anything, mock.Anything).Return(nil) gitMock.On("Commit", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) gitMock.On("Push", mock.Anything, mock.Anything, mock.Anything).Return(nil) @@ -3050,7 +3050,7 @@ replacements: [] t.Run("Cannot fetch", func(t *testing.T) { gitMock := &gitmock.Client{} gitMock.On("Init").Return(nil) - gitMock.On("Fetch", mock.Anything).Return(fmt.Errorf("cannot fetch")) + gitMock.On("ShallowFetch", mock.Anything, 1).Return(fmt.Errorf("cannot fetch")) gitMock.On("Checkout", mock.Anything, mock.Anything).Return(nil) gitMock.On("Commit", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) gitMock.On("Push", mock.Anything, mock.Anything, mock.Anything).Return(nil) @@ -3064,7 +3064,7 @@ replacements: [] t.Run("Cannot checkout", func(t *testing.T) { gitMock := &gitmock.Client{} gitMock.On("Init").Return(nil) - gitMock.On("Fetch", mock.Anything).Return(nil) + gitMock.On("ShallowFetch", mock.Anything, 1).Return(nil) gitMock.On("Checkout", mock.Anything, mock.Anything).Return(fmt.Errorf("cannot checkout")) gitMock.On("Commit", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) gitMock.On("Push", mock.Anything, mock.Anything, mock.Anything).Return(nil) @@ -3180,7 +3180,7 @@ func mockGit(t *testing.T) (gitMock *gitmock.Client, dir string, cleanup func()) gitMock = &gitmock.Client{} gitMock.On("Root").Return(dir) gitMock.On("Init").Return(nil) - gitMock.On("Fetch", mock.Anything).Return(nil) + gitMock.On("ShallowFetch", mock.Anything, 1).Return(nil) return gitMock, dir, func() { _ = os.RemoveAll(dir) }