From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4DBFE4696C0 for ; Mon, 8 Jun 2020 13:45:29 +0300 (MSK) Received: by mail-lj1-f179.google.com with SMTP id 9so19827748ljc.8 for ; Mon, 08 Jun 2020 03:45:29 -0700 (PDT) From: Cyrill Gorcunov Date: Mon, 8 Jun 2020 13:44:50 +0300 Message-Id: <20200608104450.157253-4-gorcunov@gmail.com> In-Reply-To: <20200608104450.157253-1-gorcunov@gmail.com> References: <20200608104450.157253-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test symbolic loglevels List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Part-of #689 Signed-off-by: Cyrill Gorcunov --- 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) -- 2.26.2