👷 use BrowserStack plan endpoint to gate test runs#4576
Closed
thomas-lebeau wants to merge 1 commit intomainfrom
Closed
👷 use BrowserStack plan endpoint to gate test runs#4576thomas-lebeau wants to merge 1 commit intomainfrom
thomas-lebeau wants to merge 1 commit intomainfrom
Conversation
The previous availability check listed running builds, but zombie builds (driver never connected) stay reported as running indefinitely without consuming parallel slots. Switch to /automate/plan.json which reflects the real slot usage that BrowserStack gates on.
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 69e63ad | Docs | Datadog PR Page | Give us feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
While investigating why our CI was blocked from launching new BrowserStack runs, we found that a previous CI job (
unit-bson a now-cancelled pipeline) had left 5 sessions stuck in therunningstate on BrowserStack even though the job had failed over an hour earlier. The driver client never connected (sessions are internallyqueued), so neitherDELETE /automate/sessions/{id}norDELETE /automate/builds/{id}can clear them — only BS support can.waitForAvailability()inscripts/test/bs-wrapper.tsqueries/automate/builds.json?status=running, which counts these zombie builds and would block local test runs indefinitely until BS support clears them.The BrowserStack dashboard, however, correctly showed "Parallels 0/5 running | 0 queued" — because zombie builds don't actually consume parallel slots. That state is exposed via
/automate/plan.json(parallel_sessions_running+queued_sessions), which is what BS itself gates new sessions on.Changes
BS_BUILD_URL(/automate/builds.json?status=running) withBS_PLAN_URL(/automate/plan.json) inscripts/test/bs-wrapper.tshasRunningBuild→hasParallelSessionsInUseparallel_sessions_running + queued_sessions > 0as the availability gateTest instructions
BS_USERNAME/BS_ACCESS_KEYenv varsyarn typecheck(passes)curl -s -u "$BS_USERNAME:$BS_ACCESS_KEY" https://api.browserstack.com/automate/plan.json{ parallel_sessions_running, queued_sessions, ... }yarn test:unit:bs) and verify it proceeds when no other parallel sessions are activeChecklist