Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Improve stress test

Tomas Valenta877df9218752
diff --git a/.github/workflows/stress.test.yml b/.github/workflows/stress.test.yml
index 1cb2437ef..a3c0ab458 100644
--- a/.github/workflows/stress.test.yml
+++ b/.github/workflows/stress.test.yml
@@ -28,9 +28,26 @@ jobs:
registry-url: 'https://registry.npmjs.org'
cache: npm
cache-dependency-path: tests/package-lock.json
-
+
- name: Install dependencies
working-directory: tests
run: |
npm install
- E2B_API_KEY=${{ secrets.E2B_API_KEY }} E2B_DOMAIN=${{ secrets.E2B_DOMAIN_STAGING }} npx tsx index.mts
+ npm install -g @e2b/cli
+
+ - name: Test build
+ working-directory: tests
+ run: ./build.sh
+ env:
+ E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
+ E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN_STAGING }}
+ E2B_DOMAIN: ${{ secrets.E2B_DOMAIN_STAGING }}
+
+ - name: Test run
+ working-directory: tests
+ env:
+ E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
+ E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN_STAGING }}
+ E2B_DOMAIN: ${{ secrets.E2B_DOMAIN_STAGING }}
+ run: |
+ npx tsx index.mts
diff --git a/tests/build.sh b/tests/build.sh
new file mode 100755
index 000000000..00b8becff
--- /dev/null
+++ b/tests/build.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -euo pipefail
+
+NAME="testing-$(date +"%Y-%m-%d_%H-%M")"
+CHECK_MARK="\xE2\x9C\x94\n\n"
+
+echo "Creating a new template: ${NAME}"
+e2b template build --name "${NAME}"
+printf $CHECK_MARK
+
+echo "Listing templates"
+e2b template list | grep "${NAME}" >/dev/null
+printf $CHECK_MARK
+
+echo "Creating a new instance"
+RESULT=$(node test.js "${NAME}")
+if [ "$RESULT" != "Hello World" ]; then
+ echo "Test failed: $RESULT"
+ exit 1
+fi
+printf $CHECK_MARK
+
+echo "Listing running sandboxes"
+e2b sandbox list | grep "${NAME}" >/dev/null
+printf $CHECK_MARK
+
+echo "Deleting the template: ${NAME}"
+e2b template delete -y >/dev/null
+printf $CHECK_MARK
+
+echo "Checking if the template was deleted"
+if [[ $(e2b template list) =~ ${NAME} ]]; then
+ echo "The template '${NAME}' wasn't deleted."
+ exit 1
+fi
+printf $CHECK_MARK