Skip to content

Commit

Permalink
Fix git tests for ShallowFetch instead of Fetch
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Novick <[email protected]>
  • Loading branch information
jnovick committed Aug 13, 2024
1 parent fe16b69 commit 090c10d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/argocd/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 090c10d

Please sign in to comment.