Skip to content

Commit 432cfd9

Browse files
committed
changed tests to use test template in CI
1 parent 9841d00 commit 432cfd9

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

.github/workflows/build_template.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
E2B_API_KEY:
77
required: true
88
E2B_DOMAIN:
9-
required: true
9+
required: false
10+
E2B_TEMPLATE_CONFIG:
11+
required: false
1012

1113
permissions:
1214
contents: read
@@ -54,8 +56,9 @@ jobs:
5456
run: npm install -g @e2b/cli
5557

5658
- name: Build E2B template
57-
run: e2b template build --config e2b.test.toml
59+
run: e2b template build --config ${{ secrets.E2B_TEMPLATE_CONFIG }}
5860
working-directory: ./template
5961
env:
6062
E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }}
61-
E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }}
63+
E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }}
64+
E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }}

.github/workflows/js_tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
E2B_API_KEY:
77
required: true
88
E2B_DOMAIN:
9-
required: true
9+
required: false
10+
E2B_TEMPLATE_CONFIG:
11+
required: false
1012

1113
permissions:
1214
contents: read

.github/workflows/pull_request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
secrets:
2020
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
2121
E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }}
22+
E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }}
23+
E2B_TEMPLATE_CONFIG: ${{ secrets.E2B_TEMPLATE_CONFIG }}
2224
js-sdk:
2325
uses: ./.github/workflows/js_tests.yml
2426
secrets:
@@ -29,8 +31,10 @@ jobs:
2931
secrets:
3032
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
3133
E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }}
34+
E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }}
3235
charts-tests:
3336
uses: ./.github/workflows/charts_tests.yml
3437
secrets:
3538
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
3639
E2B_DOMAIN: ${{ secrets.E2B_DOMAIN }}
40+
E2B_TEMPLATE: ${{ secrets.E2B_TEMPLATE }}

.github/workflows/python_tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
secrets:
66
E2B_API_KEY:
77
required: true
8+
E2B_DOMAIN:
9+
required: false
10+
E2B_TEMPLATE_CONFIG:
11+
required: false
812

913
permissions:
1014
contents: read

js/tests/setup.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ import { test as base } from 'vitest'
33

44
const timeoutMs = 60_000
55

6+
const template = process.env.E2B_TEMPLATE || 'code-interpreter-v1'
7+
68
interface SandboxFixture {
79
sandbox: Sandbox
810
}
911

1012
export const sandboxTest = base.extend<SandboxFixture>({
1113
sandbox: [
1214
async ({}, use) => {
13-
const sandbox = await Sandbox.create({ timeoutMs })
15+
const sandbox = await Sandbox.create(template, {
16+
timeoutMs,
17+
})
1418
try {
1519
await use(sandbox)
1620
} finally {

python/tests/conftest.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99

1010
timeout = 60
1111

12+
@pytest.fixture()
13+
def template():
14+
return os.getenv("E2B_TEMPLATE", "code-interpreter-v1")
15+
1216

1317
@pytest.fixture()
14-
def sandbox(debug):
15-
sandbox = Sandbox(timeout=timeout)
18+
def sandbox(template, debug):
19+
sandbox = Sandbox(template, timeout=timeout)
1620

1721
try:
1822
yield sandbox
@@ -27,8 +31,8 @@ def sandbox(debug):
2731

2832

2933
@pytest_asyncio.fixture
30-
async def async_sandbox(debug):
31-
sandbox = await AsyncSandbox.create(timeout=timeout)
34+
async def async_sandbox(template, debug):
35+
sandbox = await AsyncSandbox.create(template, timeout=timeout)
3236

3337
try:
3438
yield sandbox

0 commit comments

Comments
 (0)