diff --git a/tests/unit/Deployment/BuildTimeoutTest.php b/tests/unit/Deployment/BuildTimeoutTest.php deleted file mode 100644 index 98f2d78d98..0000000000 --- a/tests/unit/Deployment/BuildTimeoutTest.php +++ /dev/null @@ -1,68 +0,0 @@ - [37]; - yield 'long operator budget' => [1823]; - } - - #[DataProvider('budgets')] - public function testSubmissionUsesConstructorBudget(int $configured): void - { - $previousKey = getenv('_APP_OPENSSL_KEY_V1'); - $previousTimeout = getenv('_APP_COMPUTE_BUILD_TIMEOUT'); - putenv('_APP_OPENSSL_KEY_V1=unit-test-key'); - putenv('_APP_COMPUTE_BUILD_TIMEOUT=' . $configured); - try { - $deployment = new Document(['$id' => 'deployment', '$sequence' => '1', 'type' => 'manual', 'buildCommands' => 'npm ci']); - $database = $this->createStub(Database::class); - $database->method('updateDocument')->willReturnCallback(static function (string $collection, string $id, Document $update) use ($deployment): Document { - $deployment->setAttributes($update->getArrayCopy()); - return clone $deployment; - }); - $database->method('updateDocuments')->willReturnCallback(static function (string $collection, Document $update) use ($deployment): int { - $deployment->setAttributes($update->getArrayCopy()); - return 1; - }); - $database->method('getDocument')->willReturnCallback(static fn () => clone $deployment); - $requests = []; - $client = $this->createStub(ClientInterface::class); - $client->method('sendRequest')->willReturnCallback(static function (RequestInterface $request) use (&$requests): Response { - $requests[] = json_decode((string) $request->getBody(), true, flags: JSON_THROW_ON_ERROR); - return new Response(202, body: new Stream('{"id":"build","status":"accepted"}')); - }); - $service = new Deployments(new Jobs($client), $database, new Document(['$id' => 'project', 'region' => 'default']), ['apiHostname' => 'localhost'], $configured); - putenv('_APP_COMPUTE_BUILD_TIMEOUT=1'); - - $result = $service->createFromUpload(new Document([ - '$id' => 'function', '$collection' => 'functions', - 'runtime' => array_key_first(Config::getParam('runtimes-v2')), - ]), clone $deployment); - - $this->assertSame('waiting', $result->getAttribute('status')); - $this->assertCount(1, $requests); - $this->assertSame($configured, $requests[0]['timeoutSeconds']); - } finally { - putenv($previousKey === false ? '_APP_OPENSSL_KEY_V1' : '_APP_OPENSSL_KEY_V1=' . $previousKey); - putenv($previousTimeout === false ? '_APP_COMPUTE_BUILD_TIMEOUT' : '_APP_COMPUTE_BUILD_TIMEOUT=' . $previousTimeout); - } - } -}