Skip to content

Commit 1c51e80

Browse files
author
Ace Nassri
authored
chore(GAE logging): fix slow tests (GoogleCloudPlatform#1330)
1 parent b8453c6 commit 1c51e80

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

appengine/standard/logging/test/DeployTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,22 @@ public function testIndex()
4141
$response->getBody()->getContents()
4242
);
4343

44-
$this->verifyLog('This will show up as log level INFO', 'info');
44+
$this->verifyLog('This will show up as log level INFO', 'info', 3);
45+
46+
// These should succeed if the above call has too.
47+
// Thus, they need fewer retries!
4548
$this->verifyLog('This will show up as log level WARNING', 'warning');
4649
$this->verifyLog('This will show up as log level ERROR', 'error');
4750
}
4851

49-
private function verifyLog($message, $level, $retryCount = 5)
52+
private function verifyLog($message, $level, $retryCount = 2)
5053
{
54+
$fiveMinAgo = date(\DateTime::RFC3339, strtotime('-5 minutes'));
5155
$filter = sprintf(
52-
'resource.type = "gae_app" AND severity = "%s" AND logName = "%s"',
56+
'resource.type="gae_app" severity="%s" logName="%s" timestamp>="%s"',
5357
strtoupper($level),
54-
sprintf('projects/%s/logs/app', self::$projectId)
58+
sprintf('projects/%s/logs/app', self::$projectId),
59+
$fiveMinAgo
5560
);
5661
$logOptions = [
5762
'pageSize' => 20,

0 commit comments

Comments
 (0)