[check_postgres] [commit] More testing tweaks.

check_postgres at bucardo.org check_postgres at bucardo.org
Mon May 4 00:58:29 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

More testing tweaks.

---
 t/CP_Testing.pm |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/t/CP_Testing.pm b/t/CP_Testing.pm
index 60b9576..c997c43 100644
--- a/t/CP_Testing.pm
+++ b/t/CP_Testing.pm
@@ -87,7 +87,6 @@ sub test_database_handle {
 		print $cfh qq{\n\n## check_postgres.pl testing parameters\n};
 		print $cfh qq{listen_addresses = ''\n};
 		print $cfh qq{max_connections = 10\n};
-		print $cfh qq{max_fsm_pages = 99999\n};
 
 		## Grab the version for finicky items
 		if (qx{$initdb --version} !~ /(\d+)\.(\d+)/) {
@@ -112,6 +111,11 @@ sub test_database_handle {
 			print $cfh qq{stats_row_level = on\n};
 		}
 
+		## <= 8.3
+		if ($imaj < 8 or ($imaj==8 and $imin <= 3)) {
+			print $cfh qq{max_fsm_pages = 99999\n};
+		}
+
 		print $cfh "\n";
 		close $cfh or die qq{Could not close "$cfile": $!\n};
 
@@ -262,17 +266,15 @@ sub test_database_handle {
 
 	$dbh->{AutoCommit} = 1;
 	$dbh->{RaiseError} = 0;
-	if ($maj < 8 or ($maj==8 and $min < 1)) {
-		## Old school
-		$dbh->do('CREATE USER sixpack');
-		$dbh->do('CREATE USER readonly');
-	}
-	else {
-		$dbh->do("CREATE USER $dbuser SUPERUSER");
-		$dbh->do('CREATE USER sixpack NOSUPERUSER CREATEDB');
-		$dbh->do('CREATE USER readonly NOSUPERUSER NOCREATEDB');
+	if ($maj > 8 or ($maj==8 and $min >= 1)) {
+		$SQL = q{SELECT count(*) FROM pg_user WHERE usename = ?};
+		$sth = $dbh->prepare($SQL);
+		$sth->execute($dbuser);
+		$count = $sth->fetchall_arrayref()->[0][0];
+		if (!$count) {
+			$dbh->do("CREATE USER $dbuser SUPERUSER");
+		}
 	}
-	$dbh->do('ALTER USER readonly SET default_transaction_read_only = 1');
 	$dbh->do('CREATE DATABASE beedeebeedee');
 	$dbh->do('CREATE DATABASE ardala');
     $dbh->do('CREATE LANGUAGE plpgsql');
-- 
1.6.0.5



More information about the Check_postgres mailing list