commit b3f462bf442a98dd2ae61b6cd7f863d2e2e8c1e8 from: Vladimir Davydov via: Vladimir Davydov date: Tue Jun 14 13:47:12 2022 UTC test: fix flaky viny/tx_gap_lock test The `cmp_tuple` helper function is broken - it assumes that all tuple fields, including the payload, are numeric. It isn't true - the payload field is either nil or string. This results in a false-positive test failure: ``` error: '[string "function cmp_tuple(t1, t2) for i = 1, PAY..."]:1: attempt to compare nil with string' ``` Closes #6336 NO_DOC=test NO_CHANGELOG=test commit - e6e73423976c454bb19d7d11c078eefbb37c93e7 commit + b3f462bf442a98dd2ae61b6cd7f863d2e2e8c1e8 blob - 6270f42970243eb7b5a48ef1f8a8d6f72bcb04f4 blob + f08175e231bba79bab749c27203c529287bbbf22 --- test/vinyl/tx_gap_lock.result +++ test/vinyl/tx_gap_lock.result @@ -1311,13 +1311,13 @@ function gen_tuple(payload) end; --- ... -function cmp_tuple(t1, t2) +function tuple_equals(t1, t2) for i = 1, PAYLOAD_FIELD do if t1[i] ~= t2[i] then - return t1[i] > t2[i] and 1 or -1 + return false end end - return 0 + return true end; --- ... @@ -1373,7 +1373,7 @@ for i = 1, TX_COUNT do local result = loadstring('return ' .. sel.cmd)() if #result == #sel.result then for k, v in ipairs(result) do - if cmp_tuple(v, sel.result[k]) ~= 0 then + if not tuple_equals(v, sel.result[k]) then tx.should_abort = true break end blob - ddc5bce420f04f32814b9d1bdbf7a8d22d69862e blob + 2832281b9a4b1493fa2a44a0b432a06c30608400 --- test/vinyl/tx_gap_lock.test.lua +++ test/vinyl/tx_gap_lock.test.lua @@ -438,13 +438,13 @@ function gen_tuple(payload) return t end; -function cmp_tuple(t1, t2) +function tuple_equals(t1, t2) for i = 1, PAYLOAD_FIELD do if t1[i] ~= t2[i] then - return t1[i] > t2[i] and 1 or -1 + return false end end - return 0 + return true end; function gen_select() @@ -493,7 +493,7 @@ for i = 1, TX_COUNT do local result = loadstring('return ' .. sel.cmd)() if #result == #sel.result then for k, v in ipairs(result) do - if cmp_tuple(v, sel.result[k]) ~= 0 then + if not tuple_equals(v, sel.result[k]) then tx.should_abort = true break end