Commit 77b1bc58 authored by Christoph Berg's avatar Christoph Berg

Testsuite fixes for 8.2 and 8.3

parent 539cd003
......@@ -23,11 +23,13 @@ sub check_major {
"pg_createcluster $v main");
# check that a /var/run/postgresql/ pid file is created
my @contents = ('.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$v-main.pid", "$v-main.pg_stat_tmp");
pop @contents if ($v < 8.4); # remove pg_stat_tmp
unless ($PgCommon::rpm) {
ok_dir '/var/run/postgresql/', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$v-main.pid", "$v-main.pg_stat_tmp"],
ok_dir '/var/run/postgresql/', [@contents],
'Socket and pid file are in /var/run/postgresql/';
} else {
ok_dir '/var/run/postgresql/', ["$v-main.pid", "$v-main.pg_stat_tmp"], 'Pid File is in /var/run/postgresql/';
ok_dir '/var/run/postgresql/', [grep {/main/} @contents], 'Pid File is in /var/run/postgresql/';
}
# verify that exactly one postgres master is running
......@@ -61,7 +63,7 @@ sub check_major {
# Now there should not be an external PID file any more, since we set it
# explicitly
unless ($PgCommon::rpm) {
ok_dir '/var/run/postgresql', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$v-main.pg_stat_tmp"],
ok_dir '/var/run/postgresql', [grep {! /pid/} @contents],
'Socket, but not PID file in /var/run/postgresql/';
} else {
ok_dir '/var/run/postgresql', [], '/var/run/postgresql/ is empty';
......@@ -136,7 +138,9 @@ sub check_major {
my @l = glob ((PgCommon::cluster_data_directory $v, 'main') . "/pg_log/$v#main.log*");
is $#l, 0, 'exactly one log file';
ok (-e $l[0] && ! -z $l[0], 'custom log is actually used');
SKIP: { skip "no logging_collector in $v", 2 if ($v < 8.3);
like_program_out 'postgres', 'pg_lsclusters -h', 0, qr/^$v\s+main.*$v#main.log\n$/;
}
# clean up
PgCommon::disable_conf_value ($v, 'main', 'postgresql.conf',
......
......@@ -23,9 +23,12 @@ is ((PgCommon::get_conf_value $v, 'donau', 'postgresql.conf', 'ident_file'),
is ((PgCommon::get_conf_value $v, 'donau', 'postgresql.conf', 'external_pid_file'),
"/var/run/postgresql/$v-donau.pid", 'external_pid_file location updated');
ok (-f "/var/run/postgresql/$v-donau.pid", 'external_pid_file exists');
is ((PgCommon::get_conf_value $v, 'donau', 'postgresql.conf', 'stats_temp_directory'),
"/var/run/postgresql/$v-donau.pg_stat_tmp", 'stats_temp_directory location updated');
ok (-d "/var/run/postgresql/$v-donau.pg_stat_tmp", 'stats_temp_directory exists');
SKIP: {
skip "no stats_temp_directory in $v", 2 if ($v < 8.4);
is ((PgCommon::get_conf_value $v, 'donau', 'postgresql.conf', 'stats_temp_directory'),
"/var/run/postgresql/$v-donau.pg_stat_tmp", 'stats_temp_directory location updated');
ok (-d "/var/run/postgresql/$v-donau.pg_stat_tmp", 'stats_temp_directory exists');
}
SKIP: {
skip "cluster name not supported in $v", 1 if ($v < 9.5);
is (PgCommon::get_conf_value ($v, 'donau', 'postgresql.conf', 'cluster_name'), "$v/donau", "cluster_name is updated");
......
......@@ -74,7 +74,9 @@ is ((system "pg_ctlcluster $version main start"), 0,
'pg_ctlcluster succeeds on valid cluster owner uid/gid');
# check socket
ok_dir '/var/run/postgresql', ["$version-main.pid", "$version-main.pg_stat_tmp"], 'No sockets in /var/run/postgresql';
my @contents = ('.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$version-main.pid", "$version-main.pg_stat_tmp");
pop @contents if ($version < 8.4); # remove pg_stat_tmp
ok_dir '/var/run/postgresql', [grep {/main/} @contents], 'No sockets in /var/run/postgresql';
ok_dir $socketdir, ['.s.PGSQL.5432', '.s.PGSQL.5432.lock'], "Socket is in $socketdir";
# stop cluster, check sockets
......@@ -98,7 +100,7 @@ ok ((system "pg_ctlcluster $version main start") == 0,
if ($PgCommon::rpm) {
ok ((grep { $_ eq '.s.PGSQL.5432' } @{TestLib::dircontent('/tmp')}) == 1, 'Socket is in /tmp');
} else {
ok_dir '/var/run/postgresql', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$version-main.pid", "$version-main.pg_stat_tmp"],
ok_dir '/var/run/postgresql', [@contents],
'Socket is in default dir /var/run/postgresql';
}
ok_dir $socketdir, [], "No sockets in $socketdir";
......
......@@ -70,7 +70,7 @@ like_program_out 0, "createdb --cluster $MAJORS[-1]/foo --version", 1,
'pg_wrapper --cluster errors out for invalid cluster';
# create a database in new1 and check that it doesn't appear in new2
is_program_out 'postgres', "createdb --cluster $new1 test", 0, '';
is_program_out 'postgres', "createdb --cluster $new1 test", 0, ($MAJORS[-1] < 8.3 ? "CREATE DATABASE\n" : '');
like_program_out 'postgres', "psql -Atl --cluster $new1", 0,
qr/test\|postgres\|/,
'test db appears in cluster new1';
......
......@@ -44,8 +44,8 @@ my %test_sql_scripts = (
# create clusters
foreach my $v (@versions) {
is ((system "pg_createcluster $v main --start >/dev/null"), 0, "pg_createcluster $v main");
is_program_out 'postgres', "createdb --cluster $v/main db1", 0, '';
is_program_out 'postgres', "createdb --cluster $v/main db2", 0, '';
is_program_out 'postgres', "createdb --cluster $v/main db1", 0, ($v < 8.3 ? "CREATE DATABASE\n" : '');
is_program_out 'postgres', "createdb --cluster $v/main db2", 0, ($v < 8.3 ? "CREATE DATABASE\n" : '');
is_program_out 'postgres', "psql -q --cluster $v/main db1 -c 'CREATE TABLE log (str varchar)'", 0, '';
my @dbs = get_cluster_databases $v, 'main';
my @expected = ('template0', 'template1', 'db1', 'db2', 'postgres');
......
......@@ -8,7 +8,11 @@ use PgCommon;
my $version = $MAJORS[-1];
use Test::More tests => $PgCommon::rpm ? 1 : 39;
use Test::More tests => ($version < 8.3 or $PgCommon::rpm) ? 1 : 39;
if ($version < 8.3) {
pass 'tsearch dictionaries not tested before 8.3';
exit;
}
if ($PgCommon::rpm) {
pass 'tsearch dictionaries not handled by postgresql-common on RedHat';
exit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment