forked from TrueCloudLab/frostfs-node
[#142] metabase: Fix false-positive select
Fix a bug in the selection when an object could be added to the result after a mismatch in the previous filter. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
77e80f517f
commit
7a8f322d59
2 changed files with 34 additions and 5 deletions
|
@ -88,3 +88,26 @@ func BenchmarkDB_Select(b *testing.B) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMismatchAfterMatch(t *testing.T) {
|
||||
db := newDB(t)
|
||||
defer releaseDB(db)
|
||||
|
||||
obj := generateObject(t, testPrm{
|
||||
attrNum: 1,
|
||||
})
|
||||
|
||||
require.NoError(t, db.Put(obj))
|
||||
|
||||
a := obj.GetAttributes()[0]
|
||||
|
||||
fs := objectSDK.SearchFilters{}
|
||||
|
||||
// 1st - mismatching filter
|
||||
fs.AddFilter(a.GetKey(), a.GetValue()+"1", objectSDK.MatchStringEqual)
|
||||
|
||||
// 2nd - matching filter
|
||||
fs.AddFilter(a.GetKey(), a.GetValue(), objectSDK.MatchStringEqual)
|
||||
|
||||
testSelect(t, db, fs)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue