diff --git a/packages/js-sdk/tests/sandbox/snapshot.test.ts b/packages/js-sdk/tests/sandbox/snapshot.test.ts index 6dfc57be7..8c11c288b 100644 --- a/packages/js-sdk/tests/sandbox/snapshot.test.ts +++ b/packages/js-sdk/tests/sandbox/snapshot.test.ts @@ -72,10 +72,10 @@ sandboxTest.skipIf(isDebug)('pause and resume a sandbox with file', async ({ san assert.equal(readContent2, content) }) -sandboxTest.skipIf(isDebug)('pause and resume a sandbox long running process', async ({ sandbox }) => { +sandboxTest.skipIf(isDebug)('pause and resume a sandbox with long running process', async ({ sandbox }) => { const filename = 'test_long_running.txt' - sandbox.commands.run(`sleep 2 && echo "done" > /home/user/${filename}`) + sandbox.commands.run(`sleep 2 && echo "done" > /home/user/${filename}`, { background: true }) // the file should not exist before 2 seconds have elapsed const exists = await sandbox.files.exists(filename) @@ -95,4 +95,22 @@ sandboxTest.skipIf(isDebug)('pause and resume a sandbox long running process', a const readContent2 = await sandbox.files.read(filename) assert.equal(readContent2.trim(), 'done') }) - \ No newline at end of file + +sandboxTest.skipIf(isDebug)('pause and resume a sandbox with http server', async ({ sandbox }) => { + await sandbox.commands.run('python3 -m http.server 8000', { background: true }) + + let url = await sandbox.getHost(8000) + console.log(url) + const response1 = await fetch(`https://${url}`) + assert.equal(response1.status, 200) + + await sandbox.pause() + assert.isFalse(await sandbox.isRunning()) + + await Sandbox.resume(sandbox.sandboxId) + assert.isTrue(await sandbox.isRunning()) + + url = await sandbox.getHost(8000) + const response2 = await fetch(`https://${url}`) + assert.equal(response2.status, 200) +}) diff --git a/packages/js-sdk/tests/setup.ts b/packages/js-sdk/tests/setup.ts index d3ff8f067..b3f540706 100644 --- a/packages/js-sdk/tests/setup.ts +++ b/packages/js-sdk/tests/setup.ts @@ -1,7 +1,7 @@ import { Sandbox } from '../src' import { test as base } from 'vitest' -export const template = 'base_01' +export const template = 'base' interface SandboxFixture { sandbox: Sandbox diff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.py index 2fa1d6a6a..d06e1dfa6 100644 --- a/packages/python-sdk/tests/conftest.py +++ b/packages/python-sdk/tests/conftest.py @@ -8,7 +8,7 @@ @pytest.fixture() def template(): - return "base_01" + return "base" @pytest.fixture()