diff --git a/packages/js-sdk/tests/setup.ts b/packages/js-sdk/tests/setup.ts index 27b8f5dc3f..76b8d27bc2 100644 --- a/packages/js-sdk/tests/setup.ts +++ b/packages/js-sdk/tests/setup.ts @@ -108,6 +108,24 @@ export const buildTemplateTest = base.extend({ ], }) +/** + * Creates a build template test that is allowed to fail without breaking CI. + * - If the test passes → test passes (ideal outcome) + * - If the test fails → logs ALLOW_FAIL and test still passes + */ +export function buildTemplateTestAllowFail( + name: string, + fn: (fixtures: BuildTemplateFixture) => Promise +) { + return buildTemplateTest(name, async ({ buildTemplate }) => { + try { + await fn({ buildTemplate }) + } catch (error) { + console.error(`\n[ALLOW_FAIL] ${name}: ${error}`) + } + }) +} + export const isDebug = process.env.E2B_DEBUG !== undefined export const isIntegrationTest = process.env.E2B_INTEGRATION_TEST !== undefined diff --git a/packages/js-sdk/tests/template/methods/aptInstall.test.ts b/packages/js-sdk/tests/template/methods/aptInstall.test.ts index 3e4ad777a4..01519837cf 100644 --- a/packages/js-sdk/tests/template/methods/aptInstall.test.ts +++ b/packages/js-sdk/tests/template/methods/aptInstall.test.ts @@ -1,7 +1,7 @@ import { Template } from '../../../src' -import { buildTemplateTest } from '../../setup' +import { buildTemplateTestAllowFail } from '../../setup' -buildTemplateTest('apt install', async ({ buildTemplate }) => { +buildTemplateTestAllowFail('apt install', async ({ buildTemplate }) => { const template = Template() .fromImage('ubuntu:24.04') .skipCache() @@ -10,7 +10,7 @@ buildTemplateTest('apt install', async ({ buildTemplate }) => { await buildTemplate(template) }) -buildTemplateTest( +buildTemplateTestAllowFail( 'apt install with no install recommends', async ({ buildTemplate }) => { const template = Template() diff --git a/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py b/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py index 5ed6392072..00c93d7d08 100644 --- a/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py +++ b/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py @@ -4,6 +4,7 @@ @pytest.mark.skip_debug() +@pytest.mark.xfail(reason="aptInstall tests are optional and allowed to fail") async def test_apt_install(async_build): template = ( AsyncTemplate().from_image("ubuntu:24.04").skip_cache().apt_install("rolldice") @@ -13,6 +14,7 @@ async def test_apt_install(async_build): @pytest.mark.skip_debug() +@pytest.mark.xfail(reason="aptInstall tests are optional and allowed to fail") async def test_apt_install_no_install_recommends(async_build): template = ( AsyncTemplate() diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py b/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py index a82b93c837..1f639d2eeb 100644 --- a/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py +++ b/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py @@ -4,6 +4,7 @@ @pytest.mark.skip_debug() +@pytest.mark.xfail(reason="aptInstall tests are optional and allowed to fail") def test_apt_install(build): template = ( Template().from_image("ubuntu:24.04").skip_cache().apt_install("rolldice") @@ -13,6 +14,7 @@ def test_apt_install(build): @pytest.mark.skip_debug() +@pytest.mark.xfail(reason="aptInstall tests are optional and allowed to fail") def test_apt_install_no_install_recommends(build): template = ( Template()