summaryrefslogtreecommitdiffstats
path: root/Tests/Auth
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-09-21 20:28:27 +0000
committerJosh Hoyt <josh@janrain.com>2006-09-21 20:28:27 +0000
commitc0a725661dc3ca45cd2ca460ecf3e8c2994fc2d3 (patch)
treeee6703a0ebfee0c0e727a4582f7df921874d1ce6 /Tests/Auth
parentf4568e34c8ec98dd7f99353076ea37316825fd5f (diff)
downloadphp-openid-c0a725661dc3ca45cd2ca460ecf3e8c2994fc2d3.zip
php-openid-c0a725661dc3ca45cd2ca460ecf3e8c2994fc2d3.tar.gz
php-openid-c0a725661dc3ca45cd2ca460ecf3e8c2994fc2d3.tar.bz2
[project @ Added more output to PostGreSQL temporary DB creation failure in tests]
Diffstat (limited to 'Tests/Auth')
-rw-r--r--Tests/Auth/OpenID/StoreTest.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php
index 71e35f4..4647a56 100644
--- a/Tests/Auth/OpenID/StoreTest.php
+++ b/Tests/Auth/OpenID/StoreTest.php
@@ -358,21 +358,24 @@ explicitly');
}
$allowed_failures = 5;
- $failures = 0;
$success = false;
+ $result = null;
- while (($failures < $allowed_failures) && !$success) {
+ for ($failures = 0; $failures < $allowed_failures; $failures++) {
// Try to create the test database.
$result = $template_db->query(sprintf("CREATE DATABASE %s",
$temp_db_name));
- if (PEAR::isError($result)) {
- $failures++;
- sleep(((mt_rand(1, 100) / 100.0) * pow($failures, 2)) +
- mt_rand(2, 5));
- } else {
+ if (!PEAR::isError($result)) {
$success = true;
+ break;
}
+
+ $sleep_time = ((mt_rand(1, 100) / 100.0) * pow($failures, 2)) + 2;
+ print "Failed to create database $temp_db_name.\n".
+ "Error: " . $result->getMessage() .
+ "Waiting $sleep_time before trying again\n";
+ sleep($sleep_time);
}
if (!$success) {