Skip to content

Commit

Permalink
test: do not run on built-in
Browse files Browse the repository at this point in the history
After embedding checks to the core binary, plain require('checks') will
return embedded module. So it won't be possible to run repository module
tests (in reusable_testing or with repository CI) with repository code
until it overloads build-in code. Until [1] is resolved there are no
any other way to deal with it. (And even after [1] would be resolved,
it may worth to leave it like this to support older versions with
built-in checks.)

1. tarantool/tarantool#7774

Part of tarantool/tarantool#7726
  • Loading branch information
DifferentialOrange committed Jan 16, 2023
1 parent d167608 commit 092d931
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ lint: .rocks

.PHONY: test
test: .rocks
.rocks/bin/luatest -c -v ./test.lua
TEST_DISABLE_INBUILT_CHECKS=true .rocks/bin/luatest -c -v ./test.lua

.PHONY: perf
perf:
.rocks/bin/luatest -c ./perftest.lua
TEST_DISABLE_INBUILT_CHECKS=true .rocks/bin/luatest -c ./perftest.lua

.PHONY: clean
clean:
Expand Down
12 changes: 9 additions & 3 deletions perftest.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/usr/bin/env tarantool

local t = require('luatest')

local checks = require('checks')
local json = require('json')
local log = require('log')
local uuid = require('uuid')

local t = require('luatest')

local g = t.group('checks_performance')

if os.getenv('TEST_DISABLE_INBUILT_CHECKS') then
-- Clean up built-in checks to run tests with repository module.
package.preload['checks'] = nil
package.loaded['checks'] = nil
end
local checks = require('checks')

local args = {
['nil'] = nil,
['string'] = 'str',
Expand Down
12 changes: 9 additions & 3 deletions test.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/usr/bin/env tarantool

local t = require('luatest')

local json = require('json')
local checks = require('checks')

local t = require('luatest')

local g = t.group('checks')

if os.getenv('TEST_DISABLE_INBUILT_CHECKS') then
-- Clean up built-in checks to run tests with repository module.
package.preload['checks'] = nil
package.loaded['checks'] = nil
end
local checks = require('checks')

------------------------------------------------------------------------------
local current_file = debug.getinfo(1, 'S').short_src

Expand Down

0 comments on commit 092d931

Please sign in to comment.