From 05f2f29bb7b89c69c7d98e2067da57ee1b758fe1 Mon Sep 17 00:00:00 2001 From: Matt Brockman Date: Tue, 20 Oct 2026 15:50:50 -0700 Subject: [PATCH] Remove external HTTPS probes from tests --- tests/test_certificates.py | 46 -------------------------------------- 1 file changed, 46 deletions(-) diff --git a/tests/test_certificates.py b/tests/test_certificates.py index 417f02bc..6e56603b 100644 --- a/tests/test_certificates.py +++ b/tests/test_certificates.py @@ -1,11 +1,8 @@ -import json import shlex import pytest from e2b import Sandbox -from harness import CodeInterpreter - pytestmark = pytest.mark.skip_debug CHECK_CERTIFICATES = """ @@ -52,49 +49,6 @@ def test_certificate_stores(sandbox: Sandbox, python: str): assert "Certificate stores verified" in result.stdout -CHECK_NODE_HTTPS = """ -(async () => { -const https = require('node:https'); -const probe = (host) => new Promise((resolve, reject) => { - const request = https.get(`https://${host}/`, (response) => { - response.resume(); - resolve('connected'); - }); - request.setTimeout(15000, () => request.destroy(new Error('TLS probe timed out'))); - request.on('error', (error) => { - if (error.code === 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY' || - error.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' || - error.code === 'SELF_SIGNED_CERT_IN_CHAIN') { - resolve('untrusted'); - } else { - reject(error); - } - }); -}); -const results = await Promise.all([ - probe('dv-g3b-emudhra.we-have-a-problem.com'), - probe('dv-g3b-aaa-emudhra.we-have-a-problem.com'), - probe('nodejs.org'), -]); -console.log(JSON.stringify(results)); -})() -""" - - -def test_node_certificate_stores(sandbox: Sandbox, client: CodeInterpreter): - command = CHECK_NODE_HTTPS - result = sandbox.commands.run(f"node -e {shlex.quote(command)}") - assert json.loads(result.stdout) == ["untrusted", "untrusted", "connected"] - - execution = client.run_code("await " + command, language="js") - assert execution.error is None - assert json.loads("".join(execution.stdout)) == [ - "untrusted", - "untrusted", - "connected", - ] - - def test_java_certificate_store(sandbox: Sandbox): result = sandbox.commands.run( "/usr/lib/jvm/jdk-11/bin/keytool -J-Duser.language=en -list -v -cacerts -storepass changeit",