Resolve merge conflicts

This commit is contained in:
Khushboo Verma
2025-03-27 16:27:26 +05:30
22 changed files with 338 additions and 113 deletions
@@ -614,19 +614,26 @@ class RealtimeConsoleClientTest extends Scope
$previousBuildLogs = $response['data']['payload']['buildLogs'];
$this->assertThat(
$response['data']['payload']['status'],
$this->logicalOr(
$this->equalTo('building'),
$this->equalTo('ready'),
),
);
$this->assertEquals('building', $response['data']['payload']['status']);
if ($response['data']['payload']['status'] === 'ready') {
if (!empty($response['data']['payload']['buildEndAt'])) {
$this->assertNotEmpty($response['data']['payload']['buildEndAt']);
$this->assertNotEmpty($response['data']['payload']['buildStartAt']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildPath']);
$this->assertNotEmpty($response['data']['payload']['buildSize']);
$this->assertNotEmpty($response['data']['payload']['totalSize']);
$this->assertNotEmpty($response['data']['payload']['buildLogs']);
break;
}
}
$response = json_decode($client->receive(), true);
$this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']);
$this->assertContains('console', $response['data']['channels']);
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertEquals("ready", $response['data']['payload']['status']);
$client->close();
}
}
@@ -37,6 +37,7 @@ class SitesCustomClientTest extends Scope
$this->assertArrayHasKey('variables', $template);
$this->assertArrayHasKey('screenshotDark', $template);
$this->assertArrayHasKey('screenshotLight', $template);
$this->assertArrayHasKey('tagline', $template);
}
// List templates with pagination
@@ -126,6 +127,7 @@ class SitesCustomClientTest extends Scope
$this->assertEquals('React starter', $template['body']['name']);
$this->assertEquals(['starter'], $template['body']['useCases']);
$this->assertEquals('github', $template['body']['vcsProvider']);
$this->assertEquals('Simple React application integrated with Appwrite SDK.', $template['body']['tagline']);
$this->assertIsArray($template['body']['frameworks']);
$this->assertEquals('http://localhost/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']);
$this->assertEquals('http://localhost/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']);
@@ -2394,6 +2394,43 @@ class SitesCustomServerTest extends Scope
$this->cleanupSite($siteId);
}
public function testDomainForFailedDeloyment(): void
{
$siteId = $this->setupSite([
'siteId' => ID::unique(),
'name' => 'Test Site',
'framework' => 'astro',
'buildRuntime' => 'node-22',
'buildCommand' => 'cd random'
]);
$this->assertNotEmpty($siteId);
$domain = $this->setupSiteDomain($siteId);
$this->assertNotEmpty($domain);
$proxyClient = new Client();
$proxyClient->setEndpoint('http://' . $domain);
$deployment = $this->createDeployment($siteId, [
'code' => $this->packageSite('astro'),
'activate' => true
]);
$this->assertEquals(202, $deployment['headers']['status-code']);
$deploymentId = $deployment['body']['$id'];
$this->assertNotEmpty($deploymentId);
$this->assertEventually(function () use ($siteId, $deploymentId) {
$deployment = $this->getDeployment($siteId, $deploymentId);
$this->assertEquals('failed', $deployment['body']['status'], json_encode($deployment['body'], JSON_PRETTY_PRINT));
}, 100000, 500);
$response = $proxyClient->call(Client::METHOD_GET, '/');
$this->assertStringContainsString('build_failed', $response['body']);
$this->cleanupSite($siteId);
}
public function testPermanentRedirect(): void
{
$siteId = $this->setupSite([