From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 21 Aug 2018 15:28:35 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2] tarantoolctl: return an error on enter to a dead socket. Message-ID: <20180821122835.6w3kyvlznpxjxhij@esperanza> References: <20180821065621.27693-1-sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180821065621.27693-1-sergepetrenko@tarantool.org> To: Serge Petrenko Cc: kostja@tarantool.org, tarantool-patches@freelists.org List-ID: On Tue, Aug 21, 2018 at 09:56:21AM +0300, Serge Petrenko wrote: > +-- check enter > +do > + local dir = fio.tempdir() > + > + local code = [[ box.cfg{} ]] > + create_script(dir, 'script.lua', code) > + > + local status, err = pcall(function() > + test:test("check error codes in case of enter", function(test_i) > + test_i:plan(10) > + check_ok(test_i, dir, 'enter', 'script', 1, nil, "Can't connect to") > + local console_sock = 'script.control' > + console_sock = fio.pathjoin(dir, console_sock) > + test_i:is(fio.path.exists(console_sock), false, "directory clean") > + check_ok(test_i, dir, 'start', 'script', 0) > + tctl_wait_start(dir, 'script') > + test_i:is(fio.path.exists(console_sock), true, > + "unix socket created") > + check_ok(test_i, dir, 'stop', 'script', 0) > + wait_delete(console_sock) There's tctl_wait_stop() for this. Anyway, why do you need to start/stop instance before trying to enter it? AFAIU you just want to check that 'tarantoolctl enter' returns an error when called on a closed socket so the code below should be enough. > + test_i:is(fio.path.exists(console_sock), false, > + "remove unix socket upon exit") > + fio.open(console_sock, 'O_CREAT') > + test_i:is(fio.path.exists(console_sock), true, "file created") > + check_ok(test_i, dir, 'enter', 'script', 1, nil, "Can't connect to") > + fio.unlink(console_sock) > + end) > + end) > + > + cleanup_instance(dir, 'script') > + recursive_rmdir(dir) > + > + if status == false then > + print(("Error: %s"):format(err)) > + os.exit() > + end > +end > +