[Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels

Oleg Babin olegrok at tarantool.org
Mon Jun 8 18:31:18 MSK 2020


Thanks for your patch. LGTM.

On 08/06/2020 13:44, Cyrill Gorcunov wrote:
> Part-of #689
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
>   test/app-tap/logger.test.lua | 26 +++++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
> index c2f0ab5c0..ae4a3b99a 100755
> --- a/test/app-tap/logger.test.lua
> +++ b/test/app-tap/logger.test.lua
> @@ -1,7 +1,7 @@
>   #!/usr/bin/env tarantool
>   
>   local test = require('tap').test('log')
> -test:plan(54)
> +test:plan(62)
>   
>   -- gh-3946: Assertion failure when using log_format() before box.cfg()
>   local log = require('log')
> @@ -70,6 +70,30 @@ test:ok(box.cfg.log == filename, "filename match")
>   test:ok(box.cfg.log_level == 6, "loglevel match")
>   verify_keys("box.cfg")
>   
> +-- Test symbolic names for loglevels
> +log.cfg({level='fatal'})
> +test:ok(log.cfg.level == 0 and box.cfg.log_level == 0, 'both got fatal')
> +log.cfg({level='syserror'})
> +test:ok(log.cfg.level == 1 and box.cfg.log_level == 1, 'both got syserror')
> +log.cfg({level='error'})
> +test:ok(log.cfg.level == 2 and box.cfg.log_level == 2, 'both got error')
> +log.cfg({level='crit'})
> +test:ok(log.cfg.level == 3 and box.cfg.log_level == 3, 'both got crit')
> +log.cfg({level='warn'})
> +test:ok(log.cfg.level == 4 and box.cfg.log_level == 4, 'both got warn')
> +log.cfg({level='info'})
> +test:ok(log.cfg.level == 5 and box.cfg.log_level == 5, 'both got info')
> +log.cfg({level='verbose'})
> +test:ok(log.cfg.level == 6 and box.cfg.log_level == 6, 'both got verbose')
> +log.cfg({level='debug'})
> +test:ok(log.cfg.level == 7 and box.cfg.log_level == 7, 'both got debug')
> +
> +box.cfg{
> +    log = filename,
> +    log_level = 6,
> +    memtx_memory = 107374182,
> +}
> +
>   -- Now try to change a static field.
>   _, err = pcall(box.cfg, {log_level = 5, log = "2.txt"})
>   test:ok(tostring(err):find("can\'t be set dynamically") ~= nil)
> 


More information about the Tarantool-patches mailing list