Migrate to Github actions

This commit is contained in:
Alejandro Durante
2022-01-02 11:11:24 -03:00
parent 6c719078e5
commit 00b9c16d95
2 changed files with 31 additions and 10 deletions
+23
View File
@@ -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
View File
@@ -47,19 +47,17 @@ func TestSubmitAndStopWaitFor(t *testing.T) {
pool := pond.New(1, 10)
// Submit tasks
// Submit a long running task
var doneCount int32
for i := 0; i < 10; i++ {
pool.Submit(func() {
time.Sleep(50 * time.Millisecond)
atomic.AddInt32(&doneCount, 1)
})
}
pool.Submit(func() {
time.Sleep(2 * time.Second)
atomic.AddInt32(&doneCount, 1)
})
// Wait until all submitted tasks complete
pool.StopAndWaitFor(125 * time.Millisecond)
// Wait 100ms for the task to complete
pool.StopAndWaitFor(50 * time.Millisecond)
assertEqual(t, int32(2), atomic.LoadInt32(&doneCount))
assertEqual(t, int32(0), atomic.LoadInt32(&doneCount))
}
func TestSubmitAndStopWaitForWithEnoughDeadline(t *testing.T) {