@@ -168,8 +168,6 @@ func TestLabelsMatch(t *testing.T) {
168
168
}
169
169
}
170
170
func TestBranchMatchesCriteria (t * testing.T ) {
171
- // Remove t.Parallel() at the function level to avoid races on global variables
172
-
173
171
// Define test cases
174
172
tests := []struct {
175
173
name string
@@ -269,28 +267,8 @@ func TestBranchMatchesCriteria(t *testing.T) {
269
267
t .Run (test .name , func (t * testing.T ) {
270
268
t .Parallel () // Parallelize at the subtest level, each with their own local variables
271
269
272
- // Save original values of global variables
273
- origCombineBranchName := combineBranchName
274
- origBranchPrefix := branchPrefix
275
- origBranchSuffix := branchSuffix
276
- origBranchRegex := branchRegex
277
-
278
- // Restore original values after test
279
- defer func () {
280
- combineBranchName = origCombineBranchName
281
- branchPrefix = origBranchPrefix
282
- branchSuffix = origBranchSuffix
283
- branchRegex = origBranchRegex
284
- }()
285
-
286
- // Set global variables for this specific test
287
- combineBranchName = test .combineBranch
288
- branchPrefix = test .prefix
289
- branchSuffix = test .suffix
290
- branchRegex = test .regex
291
-
292
- // Run the function
293
- got := branchMatchesCriteria (test .branch )
270
+ // Run the function
271
+ got := branchMatchesCriteria (test .branch , test .combineBranch , test .prefix , test .suffix , test .regex )
294
272
295
273
// Check the result
296
274
if got != test .want {
0 commit comments