Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
fix flaky test due to unpredictable translation order
Browse files Browse the repository at this point in the history
  • Loading branch information
jaffee committed Oct 11, 2019
1 parent 58c2816 commit d00044f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
- *fast-checkout
- run: make install-gometalinter
- run: make gometalinter
test-golang-1.13-rc: &base-test
test-golang-1.13: &base-test
<<: *defaults
steps:
- *fast-checkout
- run: make test-all
docker:
- image: circleci/golang:1.13-rc
- image: circleci/golang:1.13
- image: pilosa/pilosa:master
test-golang-1.12:
<<: *base-test
Expand All @@ -51,7 +51,7 @@ workflows:
- linter:
requires:
- build
- test-golang-1.13-rc:
- test-golang-1.13:
requires:
- build
- test-golang-1.12:
Expand Down
14 changes: 6 additions & 8 deletions gpexp/importbatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,12 @@ func TestStringSlice(t *testing.T) {
t.Fatalf("translating: %v", err)
}

if got := b.rowIDSets["strslice"][0]; !reflect.DeepEqual(got, []uint64{1}) {
t.Fatalf("after translation, rec 0: %v", got)
}
if got := b.rowIDSets["strslice"][1]; !reflect.DeepEqual(got, []uint64{9, 1, 2}) {
t.Fatalf("after translation, rec 1: %v", got)
}
if got := b.rowIDSets["strslice"][2]; !reflect.DeepEqual(got, []uint64{10, 13, 3}) {
t.Fatalf("after translation, rec 2: %v", got)
if got0 := b.rowIDSets["strslice"][0]; len(got0) != 1 {
t.Errorf("after translation, rec 0, wrong len: %v", got0)
} else if got1 := b.rowIDSets["strslice"][1]; len(got1) != 3 || got1[0] != 9 || (got1[1] != got0[0] && got1[2] != got0[0]) {
t.Errorf("after translation, rec 1: %v, rec 0: %v", got1, got0)
} else if got2 := b.rowIDSets["strslice"][2]; len(got2) != 3 || got2[0] != 10 || got2[1] != 13 || got2[2] == got1[2] || got2[2] == got0[0] {
t.Errorf("after translation, rec 2: %v", got2)
}

err = b.doImport()
Expand Down

0 comments on commit d00044f

Please sign in to comment.