Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add killing sandboxes to stress test

Tomas Valenta2a563e66c538
diff --git a/tests/index.mts b/tests/index.mts
index d036dd847..f5b25e1cf 100644
--- a/tests/index.mts
+++ b/tests/index.mts
@@ -74,6 +74,7 @@ for (let i = 0; i < batchCount; i++) {
const first = s[0]
try {
await first.keepAlive(60 * 60 * 1000) // 4 hour
+ // Remove the first element
} catch (error) {
console.error('ERROR:', error)
}
@@ -85,6 +86,12 @@ for (let i = 0; i < batchCount; i++) {
for (const s of sandboxes) {
try {
s.close()
+
+ // Randomly kill some sandboxes
+ if (Math.random() > 0.5) {
+ await Sandbox.kill(s.id)
+ continue
+ }
} catch (error) {
console.error('ERROR:', error)
}