From da4a42dfe9a48b3feaed69f6282d601f4b6c05c9 Mon Sep 17 00:00:00 2001 From: Matthew Jaffee Date: Fri, 9 Dec 2022 12:31:04 -0600 Subject: [PATCH] use separate qcx for write/read in test now that min/max queries don't use a write Tx it seems we need to separate read and write in the tests. Not sure I 100% understand this. (cherry picked from commit a58299def4efa7843c9be1b1f20331ade2ea6d32) --- field_internal_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/field_internal_test.go b/field_internal_test.go index 59907ca30..d0b071336 100644 --- a/field_internal_test.go +++ b/field_internal_test.go @@ -692,9 +692,6 @@ func TestDecimalField_MinMaxBoundaries(t *testing.T) { func TestDecimalField_MinMaxForShard(t *testing.T) { _, _, f := newTestField(t, OptFieldTypeDecimal(3)) - qcx := f.idx.holder.txf.NewQcx() - defer qcx.Abort() - options := &ImportOptions{} for i, test := range []struct { name string @@ -738,12 +735,19 @@ func TestDecimalField_MinMaxForShard(t *testing.T) { }, } { t.Run(test.name+strconv.Itoa(i), func(t *testing.T) { - if err := f.importFloatValue(qcx, test.columnIDs, test.values, 0, options); err != nil { + qcx := f.idx.holder.txf.NewQcx() + + err := f.importFloatValue(qcx, test.columnIDs, test.values, 0, options) + if err != nil { + qcx.Abort() t.Fatalf("test %d, importing values: %s", i, err.Error()) } + qcx.Abort() shard := uint64(0) + qcx = f.idx.holder.txf.NewQcx() + defer qcx.Abort() maxvc, err := f.MaxForShard(qcx, shard, nil) if err != nil { t.Fatalf("getting max for shard: %v", err)