Migrate to Github actions
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
name: Run tests with race detection enabled
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.15.x, 1.16.x, 1.17.x]
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Install Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Test
|
||||||
|
run: go test -race -v ./
|
||||||
+8
-10
@@ -47,19 +47,17 @@ func TestSubmitAndStopWaitFor(t *testing.T) {
|
|||||||
|
|
||||||
pool := pond.New(1, 10)
|
pool := pond.New(1, 10)
|
||||||
|
|
||||||
// Submit tasks
|
// Submit a long running task
|
||||||
var doneCount int32
|
var doneCount int32
|
||||||
for i := 0; i < 10; i++ {
|
pool.Submit(func() {
|
||||||
pool.Submit(func() {
|
time.Sleep(2 * time.Second)
|
||||||
time.Sleep(50 * time.Millisecond)
|
atomic.AddInt32(&doneCount, 1)
|
||||||
atomic.AddInt32(&doneCount, 1)
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait until all submitted tasks complete
|
// Wait 100ms for the task to complete
|
||||||
pool.StopAndWaitFor(125 * time.Millisecond)
|
pool.StopAndWaitFor(50 * time.Millisecond)
|
||||||
|
|
||||||
assertEqual(t, int32(2), atomic.LoadInt32(&doneCount))
|
assertEqual(t, int32(0), atomic.LoadInt32(&doneCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSubmitAndStopWaitForWithEnoughDeadline(t *testing.T) {
|
func TestSubmitAndStopWaitForWithEnoughDeadline(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user