Combine initdb tests that successfully create a data directory.
This eliminates many seconds of test duration and the cause to invoke "rm -rf", which is typically unavailable on Windows. Michael Paquier and Noah Misch
This commit is contained in:
parent
84c08a7649
commit
1a629c1b16
@ -1,44 +1,36 @@
|
||||
# To test successful data directory creation with a additional feature, first
|
||||
# try to elaborate the "successful creation" test instead of adding a test.
|
||||
# Successful initdb consumes much time and I/O.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use Test::More tests => 19;
|
||||
use Test::More tests => 14;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $xlogdir = "$tempdir/pgxlog";
|
||||
my $datadir = "$tempdir/data";
|
||||
|
||||
program_help_ok('initdb');
|
||||
program_version_ok('initdb');
|
||||
program_options_handling_ok('initdb');
|
||||
|
||||
command_ok([ 'initdb', "$tempdir/data" ], 'basic initdb');
|
||||
command_fails([ 'initdb', "$tempdir/data" ], 'existing data directory');
|
||||
command_ok([ 'initdb', '-N', "$tempdir/data2" ], 'nosync');
|
||||
command_ok([ 'initdb', '-S', "$tempdir/data2" ], 'sync only');
|
||||
command_fails([ 'initdb', '-S', "$tempdir/data3" ],
|
||||
command_fails([ 'initdb', '-S', "$tempdir/nonexistent" ],
|
||||
'sync missing data directory');
|
||||
mkdir "$tempdir/data4" or BAIL_OUT($!);
|
||||
command_ok([ 'initdb', "$tempdir/data4" ], 'existing empty data directory');
|
||||
|
||||
system_or_bail "rm -rf '$tempdir'/*";
|
||||
|
||||
command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
|
||||
'separate xlog directory');
|
||||
|
||||
system_or_bail "rm -rf '$tempdir'/*";
|
||||
mkdir $xlogdir;
|
||||
mkdir "$xlogdir/lost+found";
|
||||
command_fails(
|
||||
[ 'initdb', '-X', 'pgxlog', "$tempdir/data" ],
|
||||
[ 'initdb', '-X', $xlogdir, $datadir ],
|
||||
'existing nonempty xlog directory');
|
||||
rmdir "$xlogdir/lost+found";
|
||||
command_fails(
|
||||
[ 'initdb', '-X', 'pgxlog', $datadir ],
|
||||
'relative xlog directory not allowed');
|
||||
|
||||
system_or_bail "rm -rf '$tempdir'/*";
|
||||
mkdir "$tempdir/pgxlog";
|
||||
command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
|
||||
'existing empty xlog directory');
|
||||
mkdir $datadir;
|
||||
command_ok([ 'initdb', '-N', '-T', 'german', '-X', $xlogdir, $datadir ],
|
||||
'successful creation');
|
||||
|
||||
system_or_bail "rm -rf '$tempdir'/*";
|
||||
mkdir "$tempdir/pgxlog";
|
||||
mkdir "$tempdir/pgxlog/lost+found";
|
||||
command_fails([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
|
||||
'existing nonempty xlog directory');
|
||||
|
||||
system_or_bail "rm -rf '$tempdir'/*";
|
||||
command_ok([ 'initdb', '-T', 'german', "$tempdir/data" ],
|
||||
'select default dictionary');
|
||||
command_ok([ 'initdb', '-S', $datadir ], 'sync only');
|
||||
command_fails([ 'initdb', $datadir ], 'existing data directory');
|
||||
|
Loading…
Reference in New Issue
Block a user