From 0dfaddf7b46bb034f4a8b3066e8a51abcc50be54 Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 10 Mar 2023 11:25:04 -0600 Subject: [PATCH] fix old typo At some point in some other refactor, this option got removed from the function call it was supposed to be an option to. But actually that was... not correct either. Because if you look closely, it turns out that this test was completely broken; we were ignoring the results that were in the test, and using inline results, but that's okay, because we were also doing the wrong query for the second test, and ignoring the Field Options specified in the test... all fixed now. --- executor_test.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/executor_test.go b/executor_test.go index b3d5ce248..29ec09e0a 100644 --- a/executor_test.go +++ b/executor_test.go @@ -1784,7 +1784,7 @@ func TestExecutor_ExecuteTopK(t *testing.T) { fieldName: "fmutex", fieldOptions: []pilosa.FieldOption{pilosa.OptFieldTypeMutex(pilosa.CacheTypeRanked, 10)}, bits: baseBits, - query: "TopK(f, k=2)", + query: "TopK(fmutex, k=2)", result: []pilosa.Pair{ {ID: 10, Count: 3}, {ID: 0, Count: 2}, @@ -1796,18 +1796,11 @@ func TestExecutor_ExecuteTopK(t *testing.T) { for _, tst := range tests { t.Run(tst.fieldName, func(t *testing.T) { - pilosa.OptFieldTypeMutex(pilosa.CacheTypeRanked, 10) - c.CreateField(t, c.Idx(), pilosa.IndexOptions{TrackExistence: true}, tst.fieldName) + c.CreateField(t, c.Idx(), pilosa.IndexOptions{TrackExistence: true}, tst.fieldName, tst.fieldOptions...) c.ImportBits(t, c.Idx(), tst.fieldName, tst.bits) if result, err := c.GetNode(0).API.Query(context.Background(), &pilosa.QueryRequest{Index: c.Idx(), Query: tst.query}); err != nil { t.Fatal(err) - } else if !reflect.DeepEqual(result.Results, []interface{}{&pilosa.PairsField{ - Pairs: []pilosa.Pair{ - {ID: 10, Count: 4}, - {ID: 0, Count: 3}, - }, - Field: "f", - }}) { + } else if !reflect.DeepEqual(result.Results, []interface{}{&pilosa.PairsField{Pairs: tst.result, Field: tst.fieldName}}) { t.Fatalf("unexpected result: %s", spew.Sdump(result)) } })