From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 171D142EF61 for ; Tue, 30 Jun 2020 19:02:48 +0300 (MSK) Received: by mail-lj1-f169.google.com with SMTP id 9so23226965ljc.8 for ; Tue, 30 Jun 2020 09:02:48 -0700 (PDT) From: Cyrill Gorcunov Date: Tue, 30 Jun 2020 19:02:09 +0300 Message-Id: <20200630160209.279470-4-gorcunov@gmail.com> In-Reply-To: <20200630160209.279470-1-gorcunov@gmail.com> References: <20200630160209.279470-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 3/3] test: app-tap/logger -- test json in boottime logger List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Cc: yaroslav.dynnikov@gmail.com Make sure we're allowed to setup json formatter before box.cfg() call, ie that named boot-time logger. Part-of #5121 Signed-off-by: Cyrill Gorcunov --- test/app-tap/logger.test.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua index ae4a3b99a..a448ba87a 100755 --- a/test/app-tap/logger.test.lua +++ b/test/app-tap/logger.test.lua @@ -1,13 +1,24 @@ #!/usr/bin/env tarantool local test = require('tap').test('log') -test:plan(62) +test:plan(64) --- gh-3946: Assertion failure when using log_format() before box.cfg() +-- +-- gh-5121: Allow to use 'json' output before box.cfg() +-- local log = require('log') -log.log_format('plain') _, err = pcall(log.log_format, 'json') -test:ok(err:find("json can\'t be used") ~= nil) +test:ok(err == nil) + +-- We're not allowed to use json with syslog though. +_, err = pcall(log.cfg, {log='syslog:', format='json'}) +test:ok(tostring(err):find("can\'t be used with syslog logger") ~= nil) + +_, err = pcall(box.cfg, {log='syslog:', log_format='json'}) +test:ok(tostring(err):find("can\'t be used with syslog logger") ~= nil) + +-- switch back to plain to next tests +log.log_format('plain') -- -- gh-689: various settings change from box.cfg/log.cfg interfaces -- 2.26.2