[tarantool-patches] Re: [PATCH v2 2/3] Syslog remote destination test

  • From: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
  • To: Olga Arkhangelskaia <arkholga@xxxxxxxxxxxxx>
  • Date: Tue, 17 Jul 2018 17:37:03 +0300

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.

Other related posts: