From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 17 Jul 2018 17:37:03 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v2 2/3] Syslog remote destination test Message-ID: <20180717143703.qmjtbtnj7hnsjax2@esperanza> References: <20180717090251.53077-1-arkholga@tarantool.org> <20180717090251.53077-3-arkholga@tarantool.org> <20180717140755.j2pn2skisgvcnep6@esperanza> <1531836924.196967966@f175.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1531836924.196967966@f175.i.mail.ru> To: Olga Arkhangelskaia Cc: tarantool-patches@freelists.org List-ID: On Tue, Jul 17, 2018 at 05:15:24PM +0300, Olga Arkhangelskaia wrote: > >> test/app-tap/syslog_remote.test.lua | 37 +++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 37 insertions(+) > >> create mode 100755 test/app-tap/syslog_remote.test.lua > > > >In review to v1 I asked you to fold this test in box-tap/cfg. > >Any reason why this couldn't/shouldn't be done? > Sorry, I did not notice that comment. However, why in box-tap/cfg.test.lua and not separately? Hmm, good question. For one thing, what's you're testing here is not a part of the application server, but is rather relevant to the box API so the test should live in box/ or box-tap/. Since box-tap/cfg.test.lua is supposed to test box.cfg() and already has all the infrastructure for starting a new tarantool instance (I mean, run_code), it feels like a good choice. Anyway, we don't usually create a new test file for each bug/feature - that'd be an overkill. We try to group tests by subsystem. I suppose, in your particular case it would be acceptable to introduce a new test file, but it should test both unix and udp sockets then IMHO, which means that you need the run_code() from box-tap/cfg.test.lua, so why not just fold the test cases there - they aren't that big, are they. > > > > >> > >> diff --git a/test/app-tap/syslog_remote.test.lua b/test/app-tap/syslog_remote.test.lua > >> new file mode 100755 > >> index 000000000..01a75fa64 > >> --- /dev/null > >> +++ b/test/app-tap/syslog_remote.test.lua > >> @@ -0,0 +1,37 @@ > >> +#!/usr/bin/env tarantool > >> + > >> +local tap = require('tap') > >> +local socket = require('socket') > >> +local os = require('os') > >> +local test = tap.test("syslog_remote") > >> +local log = require('log') > >> +local errno = require('errno') > >> + > >> +local addr = '127.0.0.1' > >> +local port = 1000 + math.random(32768) > > > >No, that's not what I meant. Using a random port like that won't save > >your from conflicts. You should retry until 'bind' succeeds. > And how to choose number of attempts? Ten is enough? I guess so. Even if you have half of the ports busy, after ten attempts the probability of repeatedly choosing a busy port is less than 0.1%, which is acceptable, I think. Also, I asked you to test invalid syslog destination (non-existing unix socket or host address). Please do so as to cover the error paths.