From 092d93152138757617bb02e69018119057d001db Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Fri, 13 Jan 2023 20:02:25 +0300 Subject: [PATCH] test: do not run on built-in 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. https://github.com/tarantool/tarantool/issues/7774 Part of tarantool/tarantool#7726 --- Makefile | 4 ++-- perftest.lua | 12 +++++++++--- test.lua | 12 +++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index cef30af..d7a7101 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/perftest.lua b/perftest.lua index 13502e7..cb00229 100755 --- a/perftest.lua +++ b/perftest.lua @@ -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', diff --git a/test.lua b/test.lua index 151278f..709f910 100755 --- a/test.lua +++ b/test.lua @@ -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