Re: Confusing TAP tests readme file

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Confusing TAP tests readme file
Дата
Msg-id CAB7nPqQsxKvk0O3shANFEza+y3Po2AeyaXCi39eEMheVRQq-PA@mail.gmail.com
обсуждение исходный текст
Ответ на Confusing TAP tests readme file  (Ildar Musin <i.musin@postgrespro.ru>)
Ответы Re: Confusing TAP tests readme file  (Fujii Masao <masao.fujii@gmail.com>)
Список pgsql-hackers
On Mon, Jul 25, 2016 at 7:42 PM, Ildar Musin <i.musin@postgrespro.ru> wrote:
> I was checking out TAP tests documentation. And I found confusing this part
> of src/test/perl/README file:
>
>     my $ret = $node->psql('postgres', 'SELECT 1');
>     is($ret, '1', 'SELECT 1 returns 1');

Good catch.

> The returning value of psql() function is the exit code of the psql. Hence
> this test will never pass since psql returns 0 if query was successfully
> executed. Probably it was meant to be the safe_psql() function instead which
> returns stdout:
>
>     my $ret = $node->safe_psql('postgres', 'SELECT 1');
>     is($ret, '1', 'SELECT 1 returns 1');
>
> or else:
>
>     my ($ret, $stdout, $stderr) =
>         $node->psql('postgres', 'SELECT 1');
>     is($stdout, '1', 'SELECT 1 returns 1');
>
> The attached patch fixes this.

Just using psql_safe looks fine to me.
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Curing plpgsql's memory leaks for statement-lifespan values
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: sslmode=require fallback