tarantool / vshard

The new generation of sharding based on virtual buckets
Other
99 stars 30 forks source link

CI allows to use undeclared variables in Lua tests, defaulting them to `nil` #492

Open Gerold103 opened 1 month ago

Gerold103 commented 1 month ago

This isn't right. If a variable is undefined, it must not be treated as nil. It must be treated as an error. @Serpentian manages to catch such things locally while CI is totally green. Need to figure out what is the setting in CI that allows such behavior, and turn it off.

Totktonada commented 1 month ago

I guess CI works on tarantool releases built in the RelWithDebInfo mode, installed using the setup-tarantool action using the official Ubuntu packages. In this build mode, the strict module disables the check. It can be enabled using require('strict').on(). On the contrary, the Debug build mode enables the strict module. That's likely the reason why the problem was caught on a developer machine.

luatest automatically requires test/helper.lua file. You can use it to enable the strict mode.

We can also use TT_PRELOAD or an override module to achieve it for wider range of the tests.

Gerold103 commented 1 month ago

Don't know if it solves the issue fully, probably not, but I did this: https://github.com/tarantool/vshard/commit/19b4de47ffc1cae3ba1d82955c5986e3ee17b232.