Re: tests for client programs

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: tests for client programs
Дата
Msg-id 1399423496.5361.3.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: tests for client programs  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: tests for client programs
Список pgsql-hackers
On Wed, 2014-04-30 at 18:09 +0200, Andres Freund wrote:
> On 2014-04-04 16:44:46 +0200, Andres Freund wrote:
> > On 2014-02-27 21:44:48 -0500, Peter Eisentraut wrote:
> > > +open HBA, ">>$tempdir/pgdata/pg_hba.conf";
> > > +print HBA "local replication all trust\n";
> > > +print HBA "host replication all 127.0.0.1/32 trust\n";
> > > +print HBA "host replication all ::1/128 trust\n";
> > > +close HBA;
> >
> > Given the recent make check security discussions, this doesn't seem like
> > a good idea...

The socket file for the test server instance is in a private directory,
so that should be safe enough.

> >
> > > +issues_sql_like(['createdb', 'foobar1'], qr/statement: CREATE DATABASE foobar1/, 'SQL CREATE DATABASE run');
> > > +issues_sql_like(['createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0'], qr/statement: CREATE
DATABASEfoobar2 ENCODING 'LATIN1'/, 'create database with encoding');
 
> >
> > Hm. Are all platforms guaranteed to provide latin1?

Yes.

> > > diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
> > > +if (!$ENV{PGPORT}) {
> > > +    $ENV{PGPORT} = 65432;
> > > +}
> > > +
> > > +$ENV{PGPORT} = int($ENV{PGPORT}) % 65536;
> >
> > Hm. I think this should use logical similar to what pg_regress is using,
> > namely test a few ports.

That could be improved in the future.


> > > +sub start_test_server {
> > > +    my ($tempdir) = @_;
> > > +    my $ret;
> > > +
> > > +    system "initdb -D $tempdir/pgdata -A trust -N >/dev/null";
> > > +    $ret = system 'pg_ctl', '-D', "$tempdir/pgdata", '-s', '-w', '-l', "$tempdir/logfile", '-o', "--fsync=off -k
$tempdir--listen-addresses='' --log-statement=all", 'start';
 
> > > +
> > > +    if ($ret != 0) {
> > > +        system('cat', "$tempdir/logfile");
> > > +        BAIL_OUT("pg_ctl failed");
> > > +    }
> > > +
> > > +    $ENV{PGHOST} = $tempdir;
> > > +    $test_server_datadir = "$tempdir/pgdata";
> > > +    $test_server_logfile = "$tempdir/logfile";
> > > +}
> >
> > Should stuff like --fsync-off, -k, really be on by default?

-k is to set the socket directory.  You might be thinking of initdb -k?


> > I think the code to massage pg_hba.conf should also be here, there'll be
> > a fair number of tests that need it.

More refactoring is always possible as needs arise.





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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [COMMITTERS] pgsql: pgindent run for 9.4
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Wanted: jsonb on-disk representation documentation