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.
This commit is contained in:
Seebs 2023-03-10 11:25:04 -06:00 committed by seebs
parent bc07fb4a96
commit 0dfaddf7b4

View file

@ -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))
}
})