From b0f7a95d26d503256d0333c69b60c720119bbf05 Mon Sep 17 00:00:00 2001 From: Kent Ross Date: Mon, 4 Mar 2024 04:20:19 -0800 Subject: [PATCH 1/2] more explicit preemption in parallel test --- group_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/group_test.go b/group_test.go index afad936..8b864c0 100644 --- a/group_test.go +++ b/group_test.go @@ -2,10 +2,10 @@ package parallel import ( "context" + "runtime" "sync" "sync/atomic" "testing" - "time" "github.com/stretchr/testify/assert" ) @@ -148,9 +148,9 @@ func testLimitedGroupMaxConcurrency(t *testing.T, name string, g Executor, limit // All the workers we *expect* to see have shown up now. Throw away all // the poison pills in the ops queue for poisonPill := range g.(*limitedGroup).ops { - time.Sleep(0) // Trigger preemption as much as we can + runtime.Gosched() // Trigger preemption as much as we can assert.NotNil(t, poisonPill) - time.Sleep(0) // Trigger preemption as much as we can + runtime.Gosched() // Trigger preemption as much as we can } blocker.Done() // unblock the workers if shouldSucceed { From 1d5b14e787c7b87a9c0255f6db2bc961c71ed759 Mon Sep 17 00:00:00 2001 From: Kent Ross Date: Mon, 4 Mar 2024 04:22:02 -0800 Subject: [PATCH 2/2] go 1.22 in the matrix --- .github/workflows/gotest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 4f560cb..ec9cc7b 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.20', '1.21.x' ] + go-version: [ '1.20', '1.21.x', '1.22.x' ] steps: - uses: actions/checkout@v4