Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
chore: fix test timeouts
Kyle Mendell7bedb67e61e1
diff --git a/.depot/workflows/ci.yml b/.depot/workflows/ci.ymlindex 3f0057d6b..8723b0863 100644--- a/.depot/workflows/ci.yml+++ b/.depot/workflows/ci.yml@@ -148,6 +148,8 @@ jobs:runs-on:size: 4x16image: g7r5wqb57k.registry.depot.dev/ci:latest+ # Passing runs finish in about 17 minutes; a broken stack must not grind through retries for hours.+ timeout-minutes: 45permissions:contents: readactions: write@@ -227,6 +229,7 @@ jobs:runs-on:size: 4x16image: g7r5wqb57k.registry.depot.dev/ci:latest+ timeout-minutes: 20permissions:contents: readactions: writediff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ef0ef978d..a91e978f9 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -239,6 +239,8 @@ jobs:name: E2E Tests (${{ matrix.database.name }})if: ${{ github.head_ref != 'l10n_crowdin' }}runs-on: depot-ubuntu-24.04-4+ # Passing runs finish in about 17 minutes; a broken stack must not grind through retries for hours.+ timeout-minutes: 45env:PLAYWRIGHT_DOCKER_IMAGE_REPOSITORY: g7r5wqb57k.registry.depot.dev/mirrors/playwrightpermissions:@@ -311,6 +313,7 @@ jobs:name: CLI E2E Tests (proxy)if: ${{ github.head_ref != 'l10n_crowdin' }}runs-on: depot-ubuntu-24.04-4+ timeout-minutes: 20permissions:contents: readactions: writediff --git a/backend/internal/middleware/environment_middleware.go b/backend/internal/middleware/environment_middleware.goindex 081a8b359..25ad1991a 100644--- a/backend/internal/middleware/environment_middleware.go+++ b/backend/internal/middleware/environment_middleware.go@@ -725,8 +725,7 @@ func (m *EnvironmentMiddleware) proxyHTTP(c *echo.Context, target string, access}defer func() { _ = resp.Body.Close() }()- m.writeProxyResponse(c, resp)- return nil+ return m.writeProxyResponse(c, resp)}// createProxyRequest builds the HTTP request to forward to the remote environment.@@ -781,8 +780,17 @@ func (m *EnvironmentMiddleware) createProxyRequest(c *echo.Context, target strinreturn req, nil}-// writeProxyResponse copies the proxy response back to the client.-func (m *EnvironmentMiddleware) writeProxyResponse(c *echo.Context, resp *http.Response) {+// writeProxyResponse copies the proxy response back to the client. An upstream+// 401 means the agent rejected the manager's credentials; passing it through+// makes browser clients treat it as a lost session, so it becomes a 502.+func (m *EnvironmentMiddleware) writeProxyResponse(c *echo.Context, resp *http.Response) error {+ if resp.StatusCode == http.StatusUnauthorized {+ slog.WarnContext(c.Request().Context(), "Remote environment rejected the manager's credentials", "target", resp.Request.URL.Host)+ return c.JSON(http.StatusBadGateway, map[string]any{+ "success": false,+ "data": map[string]any{"error": "Remote environment rejected the manager's credentials"},+ })+ }w := c.Response()hopByHop := edge.BuildHopByHopHeaders(resp.Header)edge.CopyResponseHeaders(resp.Header, w.Header(), hopByHop)@@ -791,4 +799,5 @@ func (m *EnvironmentMiddleware) writeProxyResponse(c *echo.Context, resp *http.Rif c.Request().Method != http.MethodHead {edge.CopyBodyWithFlush(w, resp.Body)}+ return nil}diff --git a/tests/playwright.config.ts b/tests/playwright.config.tsindex 2fbf521a9..405b5aca0 100644--- a/tests/playwright.config.ts+++ b/tests/playwright.config.ts@@ -15,6 +15,8 @@ export default defineConfig({failOnFlakyTests: !!process.env.CI,retries: process.env.CI ? 2 : 0,retryStrategy: 'isolated',+ globalTimeout: process.env.CI ? 35 * 60 * 1000 : 0,+ maxFailures: process.env.CI ? 20 : 0,workers,globalSetup: ['./setup/docker-browser', './setup/global-setup'],globalTeardown: './setup/global-teardown',diff --git a/tests/setup/global-setup.ts b/tests/setup/global-setup.tsindex 20772a58e..cfc90e79d 100644--- a/tests/setup/global-setup.ts+++ b/tests/setup/global-setup.ts@@ -11,7 +11,7 @@ export function captureComposeDiagnostics(composeFile: string) {fs.mkdirSync(directory, { recursive: true });for (const [name, args] of [['services', ['ps', '--all', '--format', 'json']],- ['logs', ['logs', '--no-color', '--timestamps']]+ ['logs', ['logs', '--no-color', '--timestamps', '--tail', '20000']]] as const) {try {const output = execFileSync('docker', ['compose', '-f', composeFile, ...args], {diff --git a/tests/spec/environment-settings.spec.ts b/tests/spec/environment-settings.spec.tsindex 64d7e2aa1..0135784dc 100644--- a/tests/spec/environment-settings.spec.ts+++ b/tests/spec/environment-settings.spec.ts@@ -61,6 +61,20 @@ async function createDirectEnvironmentViaUI(return { id: created.data.id, apiKey: created.data.apiKey };}+async function removeCreatedEnvironments(+ page: Page,+ environmentIds: Set<string>,+ environmentName: string+) {+ // A login redirect can swallow the create response, so also match by name.+ const response = await page.request.get('/api/environments?start=0&limit=1000');+ if (response.ok()) {+ const { data }: { data: Array<{ id: string; name: string }> } = await response.json();+ for (const env of data) if (env.name.startsWith(environmentName)) environmentIds.add(env.id);+ }+ for (const id of environmentIds) await removeApiResource(page, `/api/environments/${id}`);+}+async function openLocalEnvironment(page: Page) {await openEnvironment(page, LOCAL_ENV_ID);}@@ -292,7 +306,7 @@ test.describe('Environment Settings UI', () => {const secondNameRequest = await saveAndWaitForPut(page, environmentPath);expect(secondNameRequest.postDataJSON()).not.toHaveProperty('accessToken');} finally {- for (const id of environmentIds) await removeApiResource(page, `/api/environments/${id}`);+ await removeCreatedEnvironments(page, environmentIds, envName);}});@@ -434,7 +448,7 @@ test.describe('Environment Settings UI', () => {await page.locator('#api-url').press('Tab');await expect(tokenInput).toHaveValue('');} finally {- for (const id of environmentIds) await removeApiResource(page, `/api/environments/${id}`);+ await removeCreatedEnvironments(page, environmentIds, envName);}});