Skip to content

Commit 74b15fc

Browse files
committed
fix(tests): use stable connectivity check endpoint
Replace e2b.dev with Google's connectivity check endpoint in internet access tests for reliability.
1 parent e379f00 commit 74b15fc

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

packages/js-sdk/tests/sandbox/internetAccess.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ describe('internet access enabled', () => {
1515
async ({ sandbox }) => {
1616
// Test internet connectivity by making a curl request to a reliable external site
1717
const result = await sandbox.commands.run(
18-
"curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"
18+
"curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"
1919
)
2020
assert.equal(result.exitCode, 0)
21-
assert.equal(result.stdout.trim(), '200')
21+
assert.equal(result.stdout.trim(), '204')
2222
}
2323
)
2424
})
@@ -36,7 +36,7 @@ describe('internet access disabled', () => {
3636
// Test that internet connectivity is blocked by making a curl request
3737
try {
3838
await sandbox.commands.run(
39-
'curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev'
39+
'curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204'
4040
)
4141
// If we reach here, the command succeeded, which means internet access is not properly disabled
4242
assert.fail('Expected command to fail when internet access is disabled')
@@ -55,10 +55,10 @@ describe('internet access default', () => {
5555
async ({ sandbox }) => {
5656
// Test internet connectivity by making a curl request to a reliable external site
5757
const result = await sandbox.commands.run(
58-
"curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"
58+
"curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"
5959
)
6060
assert.equal(result.exitCode, 0)
61-
assert.equal(result.stdout.trim(), '200')
61+
assert.equal(result.stdout.trim(), '204')
6262
}
6363
)
6464
})

packages/python-sdk/tests/async/sandbox_async/test_internet_access.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ async def test_internet_access_enabled(async_sandbox_factory):
1010

1111
# Test internet connectivity by making a curl request to a reliable external site
1212
result = await sbx.commands.run(
13-
"curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"
13+
"curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"
1414
)
1515
assert result.exit_code == 0
16-
assert result.stdout.strip() == "200"
16+
assert result.stdout.strip() == "204"
1717

1818

1919
@pytest.mark.skip_debug()
@@ -24,7 +24,7 @@ async def test_internet_access_disabled(async_sandbox_factory):
2424
# Test that internet connectivity is blocked by making a curl request
2525
with pytest.raises(CommandExitException) as exc_info:
2626
await sbx.commands.run(
27-
"curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev"
27+
"curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204"
2828
)
2929
# The command should fail or timeout when internet access is disabled
3030
assert exc_info.value.exit_code != 0
@@ -36,7 +36,7 @@ async def test_internet_access_default(async_sandbox):
3636
# Test internet connectivity by making a curl request to a reliable external site
3737

3838
result = await async_sandbox.commands.run(
39-
"curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"
39+
"curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"
4040
)
4141
assert result.exit_code == 0
42-
assert result.stdout.strip() == "200"
42+
assert result.stdout.strip() == "204"

packages/python-sdk/tests/sync/sandbox_sync/test_internet_access.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ def test_internet_access_enabled(sandbox_factory):
99
sbx = sandbox_factory(allow_internet_access=True)
1010

1111
# Test internet connectivity by making a curl request to a reliable external site
12-
result = sbx.commands.run("curl -s -o /dev/null -w '%{http_code}' https://e2b.dev")
12+
result = sbx.commands.run("curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")
1313
assert result.exit_code == 0
14-
assert result.stdout.strip() == "200"
14+
assert result.stdout.strip() == "204"
1515

1616

1717
@pytest.mark.skip_debug()
@@ -21,7 +21,7 @@ def test_internet_access_disabled(sandbox_factory):
2121

2222
# Test that internet connectivity is blocked by making a curl request
2323
with pytest.raises(CommandExitException) as exc_info:
24-
sbx.commands.run("curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev")
24+
sbx.commands.run("curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204")
2525
# The command should fail or timeout when internet access is disabled
2626
assert exc_info.value.exit_code != 0
2727

@@ -32,7 +32,7 @@ def test_internet_access_default(sandbox):
3232

3333
# Test internet connectivity by making a curl request to a reliable external site
3434
result = sandbox.commands.run(
35-
"curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"
35+
"curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"
3636
)
3737
assert result.exit_code == 0
38-
assert result.stdout.strip() == "200"
38+
assert result.stdout.strip() == "204"

0 commit comments

Comments
 (0)