Scheduling tests that require exclusive access to limited resources
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
We have hundreds of tests and each requires exclusive access to a preinstalled database. There are around 10 different preinstalled databases and each test requires a specific one. Multiple tests can run at the same time as long as they are accessing different databases. Only one test can run against a specific database at a time.
The databases are preinstalled prior to running bazel. A specific database is selected by passing an envvar to the test.
Currently we are running tests with bazel sequentially which works but it slow.
Is this possible to model in bazel the exclusive resource dependency so that tests will run in parallel where possible?
We are initially trying to get this working with local execution, but would like to move to remote test execution in future.
Thanks!
### Which category does this issue belong to?
Local Execution, Core
### What underlying problem are you trying to solve with this feature?
Better test scheduling
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
8.2.1
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
The issue names no source files or tests. Start by tracing Bazel's local test scheduling and the environment-variable handling used to select preinstalled databases, then consider how the same resource model could work with remote test execution. Done means tests using different databases run concurrently while tests requiring the same database remain serialized.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100