Skip to content

Commit

Permalink
Instantiate mock client for each test in branch protection remediatio…
Browse files Browse the repository at this point in the history
…ns test (#1587)

This ensures we're not overwriting `EXPECT` calls in between the parallel
tests and thus ensuring we don't have race conditions.
  • Loading branch information
JAORMX authored Nov 8, 2023
1 parent fb1ecbb commit 7174721
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ func TestBranchProtectionRemediate(t *testing.T) {
},
}

mockClient := mock_ghclient.NewMockGitHub(ctrl)

for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

mockClient := mock_ghclient.NewMockGitHub(ctrl)

engine, err := NewGhBranchProtectRemediator(tt.newRemArgs.actionType, tt.newRemArgs.ghp, tt.newRemArgs.pbuild)
if tt.wantInitErr {
require.Error(t, err, "expected error")
Expand Down

0 comments on commit 7174721

Please sign in to comment.