Skip to content

Commit 8f15e1f

Browse files
also prepare python container in setup step
1 parent 24c155c commit 8f15e1f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/e2e/global-setup.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { getTestWorkerUrl, WranglerDevRunner } from './helpers/wrangler-runner';
1212
import {
1313
createSandboxId,
1414
createTestHeaders,
15+
createPythonImageHeaders,
1516
cleanupSandbox
1617
} from './helpers/test-fixtures';
1718

@@ -37,7 +38,7 @@ export async function setup() {
3738
workerUrl = result.url;
3839
sandboxId = createSandboxId();
3940

40-
// Initialize the sandbox
41+
// Initialize the sandboxes
4142
const headers = createTestHeaders(sandboxId);
4243
const initResponse = await fetch(`${workerUrl}/api/execute`, {
4344
method: 'POST',
@@ -49,6 +50,19 @@ export async function setup() {
4950
throw new Error(`Failed to initialize sandbox: ${initResponse.status}`);
5051
}
5152

53+
const pythonHeaders = createPythonImageHeaders(sandboxId);
54+
const pythonInitResponse = await fetch(`${workerUrl}/api/execute`, {
55+
method: 'POST',
56+
headers: pythonHeaders,
57+
body: JSON.stringify({ command: 'echo "Python sandbox initialized"' })
58+
});
59+
60+
if (!pythonInitResponse.ok) {
61+
console.warn(
62+
`Warning: Failed to initialize Python sandbox: ${pythonInitResponse.status}`
63+
);
64+
}
65+
5266
// Write state to temp file for worker threads to read
5367
writeFileSync(SHARED_STATE_FILE, JSON.stringify({ workerUrl, sandboxId }));
5468

0 commit comments

Comments
 (0)