Skip to content

Commit 08b53d7

Browse files
authored
re-enable goleak detection in ci (#832)
* re-enable goleak detection in ci * fix version string * re-add go 1.23
1 parent 129f89c commit 08b53d7

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Diff for: .github/workflows/go_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
go-version:
1515
- "1.21"
1616
- "1.22"
17-
# - "1.23"
17+
- "1.23"
1818
name: lint and test
1919
runs-on: ubuntu-latest
2020
steps:
@@ -25,8 +25,8 @@
2525
with:
2626
go-version: ${{ matrix.go-version }}
2727
- name: golangci-lint
28-
uses: golangci/golangci-lint-action@v6.5.0
28+
uses: golangci/golangci-lint-action@v6.3.2
2929
with:
30-
version: v1.59.1
30+
version: v1.61.0
3131
- name: test
3232
run: make test_ci

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test_coverage:
1616
@go test -race -v $(GO_FLAGS) -count=1 -coverprofile=coverage.out -covermode=atomic $(GO_PKGS)
1717

1818
test_ci:
19-
@TEST_ENV=ci go test -race -v $(GO_FLAGS) -count=1 $(GO_PKGS)
19+
@go test -race -v $(GO_FLAGS) -count=1 $(GO_PKGS)
2020

2121
mocks:
2222
@go generate ./...

Diff for: scheduler_test.go

+9-12
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func TestScheduler_StopTimeout(t *testing.T) {
362362
}
363363

364364
func TestScheduler_StopLongRunningJobs(t *testing.T) {
365+
defer verifyNoGoroutineLeaks(t)
365366
t.Run("start, run job, stop jobs before job is completed", func(t *testing.T) {
366367
s := newTestScheduler(t,
367368
WithStopTimeout(50*time.Millisecond),
@@ -393,6 +394,8 @@ func TestScheduler_StopLongRunningJobs(t *testing.T) {
393394
// the running job is canceled, no unexpected timeout error
394395
require.NoError(t, s.StopJobs())
395396
time.Sleep(100 * time.Millisecond)
397+
398+
require.NoError(t, s.Shutdown())
396399
})
397400
t.Run("start, run job, stop jobs before job is completed - manual context cancel", func(t *testing.T) {
398401
s := newTestScheduler(t,
@@ -428,6 +431,8 @@ func TestScheduler_StopLongRunningJobs(t *testing.T) {
428431
cancel()
429432
require.NoError(t, s.StopJobs())
430433
time.Sleep(100 * time.Millisecond)
434+
435+
require.NoError(t, s.Shutdown())
431436
})
432437
t.Run("start, run job, stop jobs before job is completed - manual context cancel WithContext", func(t *testing.T) {
433438
s := newTestScheduler(t,
@@ -464,18 +469,18 @@ func TestScheduler_StopLongRunningJobs(t *testing.T) {
464469
cancel()
465470
require.NoError(t, s.StopJobs())
466471
time.Sleep(100 * time.Millisecond)
472+
473+
require.NoError(t, s.Shutdown())
467474
})
468475
}
469476

470477
func TestScheduler_StopAndStartLongRunningJobs(t *testing.T) {
478+
defer verifyNoGoroutineLeaks(t)
471479
t.Run("start, run job, stop jobs before job is completed", func(t *testing.T) {
472480
s := newTestScheduler(t,
473481
WithStopTimeout(50*time.Millisecond),
474482
)
475483

476-
restart := false
477-
restartP := &restart
478-
479484
_, err := s.NewJob(
480485
DurationJob(
481486
50*time.Millisecond,
@@ -484,14 +489,7 @@ func TestScheduler_StopAndStartLongRunningJobs(t *testing.T) {
484489
func(ctx context.Context) {
485490
select {
486491
case <-ctx.Done():
487-
if *restartP {
488-
t.Fatal("job should not been canceled after restart")
489-
}
490492
case <-time.After(100 * time.Millisecond):
491-
if !*restartP {
492-
t.Fatal("job can not been canceled")
493-
}
494-
495493
}
496494
},
497495
),
@@ -508,11 +506,10 @@ func TestScheduler_StopAndStartLongRunningJobs(t *testing.T) {
508506
// the running job is canceled, no unexpected timeout error
509507
require.NoError(t, s.StopJobs())
510508

511-
*restartP = true
512-
513509
s.Start()
514510

515511
time.Sleep(200 * time.Millisecond)
512+
require.NoError(t, s.Shutdown())
516513
})
517514
}
518515

0 commit comments

Comments
 (0)