Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
fix template build command to include npm start command and add nextjs stress test to integration suite
0div3245acd4d982
diff --git a/packages/js-sdk/tests/integration/stress.test.ts b/packages/js-sdk/tests/integration/stress.test.tsindex b82830372..c880dcbb2 100644--- a/packages/js-sdk/tests/integration/stress.test.ts+++ b/packages/js-sdk/tests/integration/stress.test.ts@@ -9,13 +9,14 @@ for (let i = 0; i < view.length; i++) {view[i] = Math.floor(Math.random() * 256)}-const integrationTestTemplate = 'jonas_base'+const integrationTestTemplate = 'integration-test-v1'+const sanboxCount = 10test.skipIf(!isIntegrationTest)('stress test heavy file writes and reads',async () => {const promises: Array<Promise<string | void>> = []- for (let i = 0; i < 500; i++) {+ for (let i = 0; i < sanboxCount; i++) {promises.push(Sandbox.create(integrationTestTemplate, { timeoutMs: 60 }).then((sbx) => {@@ -35,7 +36,7 @@ test.skipIf(!isIntegrationTest)(test.skipIf(!isIntegrationTest)('stress network ingress', async ({}) => {const promises: Array<Promise<string | void>> = []- for (let i = 0; i < 10; i++) {+ for (let i = 0; i < sanboxCount; i++) {promises.push(Sandbox.create(integrationTestTemplate, { timeoutMs: 60 }).then((sbx) => {console.log('created sandbox', sbx.sandboxId)@@ -71,3 +72,37 @@ test.skipIf(!isIntegrationTest)('stress network ingress', async ({}) => {await wait(10_000)await Promise.all(promises)})++test.skipIf(!isIntegrationTest)('stress requests to nextjs app', async ({}) => {+ const promises: Array<Promise<string | void>> = []++ for (let i = 0; i < sanboxCount; i++) {+ promises.push(+ Sandbox.create(integrationTestTemplate, { timeoutMs: 60_000 })+ .then((sbx) => {+ console.log('created sandbox', sbx.sandboxId)+ return new Promise((resolve, reject) => {+ try {+ resolve(sbx.getHost(3000))+ } catch (e) {+ console.error('error getting sbx host', e)+ reject(e)+ }+ }).then(async (host) => {+ const url = `https://${host}`+ console.log('fetching url', url)+ await fetch(url).then(async (res) => {+ console.log('response', res.status)+ await res.text().then((text) => {+ console.log('response body', text)+ })+ })+ })+ })+ .catch(console.error)+ )+ }++ await wait(10_000)+ await Promise.all(promises)+})diff --git a/packages/js-sdk/tests/integration/template/README.md b/packages/js-sdk/tests/integration/template/README.mdnew file mode 100644index 000000000..7da9296a3--- /dev/null+++ b/packages/js-sdk/tests/integration/template/README.md@@ -0,0 +1,5 @@+# Integration test template++# Build the template++`$ e2b template build -c "cd /basic-nextjs-app/ && sudo npm run dev"`