Fix PHP CI legacy and edge gateway tests
- Match self-serve legacy test double invoice signature. - Wait for the edge gateway integration database before bootstrapping schema.
This commit is contained in:
+20
-2
@@ -384,8 +384,7 @@ function edge_gateway_integration_context(): array
|
||||
}
|
||||
};
|
||||
|
||||
$db = new db($dbConfig);
|
||||
$db->connect();
|
||||
$db = edge_gateway_integration_wait_for_db($dbConfig);
|
||||
$GLOBALS['db'] = $db;
|
||||
|
||||
$mysqli = $db->conn();
|
||||
@@ -412,6 +411,25 @@ function edge_gateway_integration_context(): array
|
||||
];
|
||||
}
|
||||
|
||||
function edge_gateway_integration_wait_for_db(array $dbConfig): db
|
||||
{
|
||||
$deadline = microtime(true) + 60;
|
||||
$lastError = null;
|
||||
|
||||
do {
|
||||
try {
|
||||
$db = new db($dbConfig);
|
||||
$db->connect();
|
||||
return $db;
|
||||
} catch (RuntimeException $exception) {
|
||||
$lastError = $exception;
|
||||
usleep(500000);
|
||||
}
|
||||
} while (microtime(true) < $deadline);
|
||||
|
||||
throw $lastError ?? new RuntimeException('Database connection failed before a connection attempt completed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{host:string,user:string,password:string,database:string,port:int}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user