mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix remaining tests
This commit is contained in:
@@ -693,7 +693,7 @@ class Builds extends Action
|
||||
cpus: $cpus,
|
||||
memory: $memory,
|
||||
timeout: $timeout,
|
||||
remove: true,
|
||||
remove: true,
|
||||
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
||||
destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}",
|
||||
variables: $vars,
|
||||
@@ -746,7 +746,12 @@ class Builds extends Action
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($logs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$currentLogs = $deployment->getAttribute('buildLogs', '');
|
||||
$affected = false;
|
||||
|
||||
$streamLogs = \str_replace("\\n", "{APPWRITE_LINEBREAK_PLACEHOLDER}", $logs);
|
||||
foreach (\explode("\n", $streamLogs) as $streamLog) {
|
||||
@@ -759,14 +764,20 @@ class Builds extends Action
|
||||
|
||||
// TODO: use part[0] as timestamp when switching to dbForLogs for build logs
|
||||
$currentLogs .= $streamParts[1];
|
||||
|
||||
if (!empty($streamParts[1])) {
|
||||
$affected = true;
|
||||
}
|
||||
}
|
||||
|
||||
$deployment = $deployment->setAttribute('buildLogs', $currentLogs);
|
||||
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
||||
if ($affected) {
|
||||
$deployment = $deployment->setAttribute('buildLogs', $currentLogs);
|
||||
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
||||
|
||||
$queueForRealtime
|
||||
->setPayload($deployment->getArrayCopy())
|
||||
->trigger();
|
||||
$queueForRealtime
|
||||
->setPayload($deployment->getArrayCopy())
|
||||
->trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -1199,6 +1210,13 @@ class Builds extends Action
|
||||
$message = "[31m" . $message;
|
||||
}
|
||||
|
||||
$separator = \strpos($message, '{APPWRITE_DETECTION_SEPARATOR_START}');
|
||||
if ($separator !== false) {
|
||||
$error = \substr($message, $separator + strlen('{APPWRITE_DETECTION_SEPARATOR_START}'));
|
||||
$message = \substr($message, 0, $separator);
|
||||
$message .= "\n[31m" . $error;
|
||||
}
|
||||
|
||||
$endTime = DateTime::now();
|
||||
$durationEnd = \microtime(true);
|
||||
$deployment->setAttribute('buildEndedAt', $endTime);
|
||||
|
||||
@@ -607,15 +607,6 @@ class RealtimeConsoleClientTest extends Scope
|
||||
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
|
||||
$this->assertArrayHasKey('buildLogs', $response['data']['payload']);
|
||||
|
||||
// Ignore comparasion for first payload
|
||||
if ($previousBuildLogs !== null) {
|
||||
$this->assertNotEquals($previousBuildLogs, $response['data']['payload']['buildLogs']);
|
||||
}
|
||||
|
||||
$previousBuildLogs = $response['data']['payload']['buildLogs'];
|
||||
|
||||
$this->assertEquals('building', $response['data']['payload']['status']);
|
||||
|
||||
if (!empty($response['data']['payload']['buildEndedAt'])) {
|
||||
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
|
||||
$this->assertNotEmpty($response['data']['payload']['buildStartedAt']);
|
||||
@@ -626,6 +617,15 @@ class RealtimeConsoleClientTest extends Scope
|
||||
$this->assertNotEmpty($response['data']['payload']['buildLogs']);
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore comparasion for first payload
|
||||
if ($previousBuildLogs !== null) {
|
||||
$this->assertNotEquals($previousBuildLogs, $response['data']['payload']['buildLogs']);
|
||||
}
|
||||
|
||||
$previousBuildLogs = $response['data']['payload']['buildLogs'];
|
||||
|
||||
$this->assertEquals('building', $response['data']['payload']['status']);
|
||||
}
|
||||
|
||||
$response = json_decode($client->receive(), true);
|
||||
|
||||
@@ -2646,7 +2646,7 @@ class SitesCustomServerTest extends Scope
|
||||
$this->assertEventually(function () use ($siteId, $deploymentId) {
|
||||
$deployment = $this->getDeployment($siteId, $deploymentId);
|
||||
$this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
|
||||
$this->assertStringContainsString('Error:', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
|
||||
$this->assertStringContainsString('No such file or directory', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
|
||||
}, 100000, 500);
|
||||
|
||||
$this->cleanupSite($siteId);
|
||||
|
||||
Reference in New Issue
Block a user