Skip to content

test: vinyl_is_broken() check is not fully correct #103

Closed
@Totktonada

Description

@Totktonada

I'm about 838c2d1 and, in particular, about the following code:

expirationd/test/helper.lua

Lines 251 to 262 in 838c2d1

function helpers.vinyl_is_broken()
-- Blocked by https://github.com/tarantool/tarantool/issues/6448
local major, minor, patch = helpers.tarantool_version()
-- Since Tarantool 1.10.11.
local broken_v1_10 = major >= 1 and (minor > 10 or minor == 10 and patch >= 11)
-- Tarantool >= 2.1.0 and < 2.8.2.
local broken_v2 = (major >= 2 and major < 3) and (minor >= 1 and minor < 8 or minor == 8 and patch <= 2)
return broken_v1_10 or broken_v2
end

See, broken_v1_10 may be true on 2.*, so the function will return true on, say, 2.11.0.

The second condition (broken_v2) looks correct. However I propose to consider a bit more strict way to write such checks, see tarantool/crud#227. In brief, if a problem was fixed in, say, 1.10.2, 2.1.3, 2.2.2, 2.3.1 (and all 2.4* and all 3.* by construction), the condition will be the following:

-- `true` if it works, `false` otherwise.
(major == 1 and minor == 10 and patch >= 2) or
(major == 2 and minor == 1 and patch >= 3) or
(major == 2 and minor == 2 and patch >= 2) or
(major == 2 and minor == 3 and patch >= 1) or
(major == 2 and minor >= 4) or
(major >= 3)

There are less chances to make a mistake when such strict form of condition is used.

While I'm here, it worth to share the recipe how to determine, where a particular change lands in tarantool's long-term branches:

$ (needle='vinyl: fix use of dropped space in deferred DELETE handler'; for branch in 1.7 1.9 1.10 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 master; do printf "${branch}\t"; commit_description=$(git log --oneline "origin/${branch}" | grep -F "${needle}"); [ -n "${commit_description}" ] && echo "$(git describe --long --always $(echo "${commit_description}" | cut -d" " -f1)) $(echo "${commit_description}" | cut -d" " -f2-)" || echo "(not found)"; done)

1.7	(not found)
1.9	(not found)
1.10	1.10.11-5-g40d8f4df1 vinyl: fix use of dropped space in deferred DELETE handler
2.1	(not found)
2.2	(not found)
2.3	(not found)
2.4	(not found)
2.5	(not found)
2.6	(not found)
2.7	(not found)
2.8	2.8.2-12-g2663a9c6c vinyl: fix use of dropped space in deferred DELETE handler
master	2.10.0-beta1-51-g0428bbcef vinyl: fix use of dropped space in deferred DELETE handler

So, it lands to 1.10.12, 2.8.3 and will land to future 2.10.0. All 2.11+ and 3+ will be unaffected as well, of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthImprove code readability, simplify maintenance and so ongood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions