From d00044fc73de53a1c3472b1ea66a72410b64d86e Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Thu, 10 Oct 2019 22:24:44 -0500 Subject: [PATCH] fix flaky test due to unpredictable translation order --- .circleci/config.yml | 6 +++--- gpexp/importbatch_test.go | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b48d376..99d0942 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -51,7 +51,7 @@ workflows: - linter: requires: - build - - test-golang-1.13-rc: + - test-golang-1.13: requires: - build - test-golang-1.12: diff --git a/gpexp/importbatch_test.go b/gpexp/importbatch_test.go index c097de2..7764d10 100644 --- a/gpexp/importbatch_test.go +++ b/gpexp/importbatch_test.go @@ -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()