(host, port)
| 100 | } |
| 101 | |
| 102 | async function runPublicSmokeCheck(host, port) { |
| 103 | const deadline = Date.now() + PUBLIC_SMOKE_TIMEOUT_MS; |
| 104 | let lastError = new Error('public runtime did not become healthy'); |
| 105 | |
| 106 | while (Date.now() < deadline) { |
| 107 | try { |
| 108 | const loginResponse = await requestRuntime(host, port, '/login'); |
| 109 | if (loginResponse.statusCode !== 200) { |
| 110 | throw new Error(`/login returned ${loginResponse.statusCode}`); |
| 111 | } |
| 112 | |
| 113 | const assetPath = extractStaticAssetPath(loginResponse.body); |
| 114 | if (!assetPath) { |
| 115 | throw new Error('/login did not reference any /_next/static asset'); |
| 116 | } |
| 117 | |
| 118 | const assetResponse = await requestRuntime(host, port, assetPath, 'HEAD'); |
| 119 | if (assetResponse.statusCode !== 200) { |
| 120 | throw new Error(`${assetPath} returned ${assetResponse.statusCode}`); |
| 121 | } |
| 122 | |
| 123 | return assetPath; |
| 124 | } catch (error) { |
| 125 | lastError = error; |
| 126 | await delay(PUBLIC_SMOKE_RETRY_MS); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | throw lastError; |
| 131 | } |
| 132 | |
| 133 | function stopChild(child, signal = 'SIGTERM') { |
| 134 | return new Promise((resolve) => { |
no test coverage detected