Skip to content

Commit

Permalink
add CI for unit tests (#1368)
Browse files Browse the repository at this point in the history
* add CI for unit tests

* fix some tests that did not close their index

* increase delays for tests running via github actions

seems as though on the machines these tests run
sometimes by the time the cancel fires all the
results have been returned anyway in spite of
their delays
  • Loading branch information
mschoch authored Apr 20, 2020
1 parent dad4052 commit 4dc1310
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches:
- master
pull_request:
name: Tests
jobs:
test:
strategy:
matrix:
go-version: [1.13.x, 1.14.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go version
go test -race ./...
4 changes: 2 additions & 2 deletions index_alias_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ func TestIndexAliasMultipleLayer(t *testing.T) {
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(50 * time.Millisecond):
case <-time.After(250 * time.Millisecond):
return nil
}
},
Expand Down Expand Up @@ -1042,7 +1042,7 @@ func TestIndexAliasMultipleLayer(t *testing.T) {
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(50 * time.Millisecond):
case <-time.After(250 * time.Millisecond):
return nil
}
},
Expand Down
12 changes: 10 additions & 2 deletions search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,11 @@ func TestSearchScoreNone(t *testing.T) {
}

defer func() {
err := os.RemoveAll("testidx")
err := idx.Close()
if err != nil {
t.Fatal(err)
}
err = os.RemoveAll("testidx")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1609,7 +1613,11 @@ func TestGeoDistanceIssue1301(t *testing.T) {
}

defer func() {
err := os.RemoveAll("testidx")
err := idx.Close()
if err != nil {
t.Fatal(err)
}
err = os.RemoveAll("testidx")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 4dc1310

Please sign in to comment.