From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 52C23272AD for ; Fri, 13 Jul 2018 06:29:52 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CAQMLFq1o_XB for ; Fri, 13 Jul 2018 06:29:52 -0400 (EDT) Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 042B927222 for ; Fri, 13 Jul 2018 06:29:52 -0400 (EDT) From: Olga Arkhangelskaia Subject: [tarantool-patches] [PATCH 2/3] Syslog remote destination test Date: Fri, 13 Jul 2018 13:29:37 +0300 Message-Id: <20180713102938.31897-3-arkholga@tarantool.org> In-Reply-To: <20180713102938.31897-1-arkholga@tarantool.org> References: <20180713102938.31897-1-arkholga@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Olga Arkhangelskaia Adds syslog remote destination test in app-tap. Test creates server, sets appropriate log level and redirects logs to it. If log level received by the server is the same - test passes. Usage: test-run.py syslog Signed-off-by: Olga Arkhangelskaia --- test/app-tap/syslog_remote.test.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 test/app-tap/syslog_remote.test.lua diff --git a/test/app-tap/syslog_remote.test.lua b/test/app-tap/syslog_remote.test.lua new file mode 100755 index 000000000..c7bb773fa --- /dev/null +++ b/test/app-tap/syslog_remote.test.lua @@ -0,0 +1,33 @@ +#!/usr/bin/env tarantool + +local tap = require('tap') +local socket = require('socket') +local os = require('os') +local test = tap.test("syslog_remote") + +test:plan(1) +local addr = '127.0.0.1' +local port = 8888 + +local function start_server() + test:diag("Starting server") + local server = socket.tcp_server(addr, port, function() end) + + local sc = socket('AF_INET', 'SOCK_DGRAM', 'udp') + sc:bind('127.0.0.1', 8888) + return server, sc +end + +local function find_log_level() + local opt = 'syslog:server='..addr..':'..port..',identity=tarantool' + box.cfg{log = opt, log_level = 7} + local buf = sc:read(300) + test:ok(buf:match('log level 7')) +end + +server,sc = start_server() + +test:test('syslog_remote',find_log_level(test)) +sc:close() +server:shutdown() +os.exit(test:check() == true) -- 2.14.3 (Apple Git-98)