Skip to content

Commit ac16a84

Browse files
committed
updated tests - use correct template
1 parent 76f15f8 commit ac16a84

File tree

19 files changed

+76
-74
lines changed

19 files changed

+76
-74
lines changed

js/tests/env_vars/bash.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// Bash Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (bash)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (bash)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -40,8 +40,8 @@ sandboxTest('env vars per execution (bash)', async ({ sandbox }) => {
4040
expect(result_empty.logs.stdout[0]).toEqual('default\n')
4141
})
4242

43-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
44-
const sandbox = await Sandbox.create({
43+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
44+
const sandbox = await Sandbox.create(template, {
4545
envs: { TEST_ENV_VAR: 'supertest' },
4646
})
4747

js/tests/env_vars/deno.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// Deno Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (deno)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (deno)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -40,8 +40,8 @@ sandboxTest('env vars per execution (deno)', async ({ sandbox }) => {
4040
expect(result_empty.results[0]?.text.trim()).toEqual('default')
4141
})
4242

43-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
44-
const sandbox = await Sandbox.create({
43+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
44+
const sandbox = await Sandbox.create(template, {
4545
envs: { TEST_ENV_VAR: 'supertest' },
4646
})
4747

js/tests/env_vars/java.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// Java Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (java)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (java)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -43,8 +43,8 @@ sandboxTest('env vars per execution (java)', async ({ sandbox }) => {
4343
expect(result_empty.results[0]?.text.trim()).toEqual('default')
4444
})
4545

46-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
47-
const sandbox = await Sandbox.create({
46+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
47+
const sandbox = await Sandbox.create(template, {
4848
envs: { TEST_ENV_VAR: 'supertest' },
4949
})
5050

js/tests/env_vars/js.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// JavaScript Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (javascript)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (javascript)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -40,8 +40,8 @@ sandboxTest('env vars per execution (javascript)', async ({ sandbox }) => {
4040
expect(result_empty.results[0]?.text.trim()).toEqual('default')
4141
})
4242

43-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
44-
const sandbox = await Sandbox.create({
43+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
44+
const sandbox = await Sandbox.create(template, {
4545
envs: { TEST_ENV_VAR: 'supertest' },
4646
})
4747

js/tests/env_vars/python.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// Python Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (python)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (python)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -40,8 +40,8 @@ sandboxTest('env vars per execution (python)', async ({ sandbox }) => {
4040
expect(result_empty.results[0]?.text.trim()).toEqual('default')
4141
})
4242

43-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
44-
const sandbox = await Sandbox.create({
43+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
44+
const sandbox = await Sandbox.create(template, {
4545
envs: { TEST_ENV_VAR: 'supertest' },
4646
})
4747

js/tests/env_vars/r.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isDebug, sandboxTest } from '../setup'
44
import { Sandbox } from '../../src'
55

66
// R Env Vars
7-
sandboxTest.skipIf(isDebug)('env vars on sandbox (R)', async () => {
8-
const sandbox = await Sandbox.create({
7+
sandboxTest.skipIf(isDebug)('env vars on sandbox (R)', async ({ template }) => {
8+
const sandbox = await Sandbox.create(template, {
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111

@@ -37,8 +37,8 @@ sandboxTest('env vars per execution (R)', async ({ sandbox }) => {
3737
expect(result_empty.results[0]?.text.trim()).toEqual(`[1] "default"`)
3838
})
3939

40-
sandboxTest.skipIf(isDebug)('env vars overwrite', async () => {
41-
const sandbox = await Sandbox.create({
40+
sandboxTest.skipIf(isDebug)('env vars overwrite', async ({ template }) => {
41+
const sandbox = await Sandbox.create(template, {
4242
envs: { TEST_ENV_VAR: 'supertest' },
4343
})
4444

js/tests/setup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const template = process.env.E2B_TESTS_TEMPLATE || 'code-interpreter-v1'
77

88
interface SandboxFixture {
99
sandbox: Sandbox
10+
template: string
1011
}
1112

1213
export const sandboxTest = base.extend<SandboxFixture>({
@@ -31,6 +32,7 @@ export const sandboxTest = base.extend<SandboxFixture>({
3132
},
3233
{ auto: true },
3334
],
35+
template
3436
})
3537

3638
export const isDebug = process.env.E2B_DEBUG !== undefined

python/tests/async/env_vars/test_bash.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import pytest
22
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
3-
from typing import AsyncGenerator
43

54
@pytest.mark.skip_debug()
6-
async def test_env_vars_on_sandbox():
7-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
5+
async def test_env_vars_on_sandbox(template):
6+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
87
try:
98
result = await sandbox.run_code(
109
"echo $TEST_ENV_VAR",
@@ -30,8 +29,8 @@ async def test_env_vars_per_execution(sandbox: AsyncSandbox):
3029
assert result_empty.logs.stdout[0] == "default\n"
3130

3231
@pytest.mark.skip_debug()
33-
async def test_env_vars_overwrite():
34-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
32+
async def test_env_vars_overwrite(template):
33+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
3534
try:
3635
result = await sandbox.run_code(
3736
"echo $TEST_ENV_VAR",

python/tests/async/env_vars/test_deno.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
33

44
@pytest.mark.skip_debug()
5-
async def test_env_vars_on_sandbox():
6-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
5+
async def test_env_vars_on_sandbox(template):
6+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
77
try:
88
result = await sandbox.run_code(
99
"const x = Deno.env.get('TEST_ENV_VAR'); x",
@@ -14,7 +14,8 @@ async def test_env_vars_on_sandbox():
1414
finally:
1515
await sandbox.kill()
1616

17-
async def test_env_vars_per_execution(sandbox: AsyncSandbox):
17+
async def test_env_vars_per_execution(sandbox: AsyncSandbox, template):
18+
sandbox = await AsyncSandbox.create(template=template)
1819
result = await sandbox.run_code(
1920
"Deno.env.get('FOO')",
2021
envs={"FOO": "bar"},
@@ -32,8 +33,8 @@ async def test_env_vars_per_execution(sandbox: AsyncSandbox):
3233
assert result_empty.text.strip() == "default"
3334

3435
@pytest.mark.skip_debug()
35-
async def test_env_vars_overwrite():
36-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
36+
async def test_env_vars_overwrite(template):
37+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
3738
try:
3839
result = await sandbox.run_code(
3940
"const x = Deno.env.get('TEST_ENV_VAR'); x",

python/tests/async/env_vars/test_java.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
33

44
@pytest.mark.skip_debug()
5-
async def test_env_vars_on_sandbox():
6-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
5+
async def test_env_vars_on_sandbox(template):
6+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
77
try:
88
result = await sandbox.run_code(
99
'System.getProperty("TEST_ENV_VAR")',
@@ -32,8 +32,8 @@ async def test_env_vars_per_execution(sandbox: AsyncSandbox):
3232
assert result_empty.text.strip() == "default"
3333

3434
@pytest.mark.skip_debug()
35-
async def test_env_vars_overwrite():
36-
sandbox = await AsyncSandbox.create(envs={"TEST_ENV_VAR": "supertest"})
35+
async def test_env_vars_overwrite(template):
36+
sandbox = await AsyncSandbox.create(template=template, envs={"TEST_ENV_VAR": "supertest"})
3737
try:
3838
result = await sandbox.run_code(
3939
'System.getProperty("TEST_ENV_VAR")',

0 commit comments

Comments
 (0)