CI Tests on Spot Instances
Running Playwright E2E tests on CI Spot Instances and using Currents Orchestration to automatically rerouting tests before an eviction.
An additional benefit of using Currents for balancing tests is the ability to automatically redrive tests from one machine to another.
Cost Efficiency of Spot Instances
Many cloud providers have an option to use Spot Instances for running workloads. Using Spot Instances can cost up to 90% lower, compared to the traditionally allocated resources.

However, spot instances can be terminated at any time, which can cause the loss of the test results.
Currents Orchestration can automatically reassign the tests from to-be-terminated instance to another machine. This way, the execution can continue without manual intervention.
How it works
Imagine a scenario when you have two machines running a testing suite consisting of two spec files.
Machine A - running specA
Machine B - running specB
When a spot instance is just about to be terminated (let's say Machine A), Currents will identify the affected spec files and reassign them a different machine.

Setup and configuration
Starting from version 1.3.0
of @currents/playwright,
you can specify a pwc-p
option:
pwc-p .... --pwc-reset-signal SIGUSR1|SIGUSR2
When specified, pwc-p
will start listening to POSIX signal (SIGUSR1
or SIGUSR2
). After receiving the signal, the tool will send a request to Currents servers with the details of the tests that need to be reassigned.
Currents will update the run status accordingly and will send the affected tests to the first available CI machine.
An example output you're expected to see upon termination:
$ npx pwc-p --key XXX --project-id YYY --ci-build-id reset-001 --pwc-reset-signal SIGUSR1
🚥 Will reset tests on SIGUSR1. PID: 66640
🚀 Starting orchestration session...
📦 Currents reporter: 1.3.0 recording CI build reset-001 for project YYY
🎭 Playwright: 1.44.0 1 test in 1 project [chromium]
🌐 Executing orchestrated task: [chromium] test.spec.ts
🌐 Run URL: https://app.currents.dev/run/c11610c6e1644913
================================================================
2024-05-15T23:31:57.336Z starting test attempt #1: [chromium] › test.spec.ts:15:5 › A
# in another terminal: kill -SIGUSR1 66640
🚥 Received SIGUSR1
🚥 Resetting tests: machineId: 3SN5zz9Mhl2ALzzB, runId: c11610c6e1644913
🚥 Success resetting tests: machineId: 3SN5zz9Mhl2ALzzB, runId: c11610c6e1644913
Refer to the following documentation for capturing the eviction notice for various cloud providers:
Last updated
Was this helpful?