litmuschaos / litmuschaos/litmus-java-sdk
feat: Add experiment run polling helper
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 6
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Description
Add a polling helper that waits until an experiment run reaches a terminal phase.
The SDK currently exposes LitmusClient#getExperimentRun(), which retrieves the current state of an experiment run once.
Applications that need the final result must implement their own polling loop, timeout handling, and terminal-phase checks.
This feature should provide a consistent SDK-level helper for that workflow.
Proposed API
ExperimentRun waitForExperimentRun(
String projectId,
String experimentRunId,
Duration timeout,
Duration interval
)
Scope
- Add
waitForExperimentRun()tosrc/main/java/io/litmuschaos/LitmusClient.java. - Add a polling helper class under
src/main/java/io/litmuschaos/util/. - Reuse the existing
getExperimentRun()query. - Poll at the configured interval until a terminal phase is reached.
- Return the final
ExperimentRunresponse when polling finishes successfully. - Throw a clear exception when the configured timeout is exceeded.
- Add JavaDoc and unit tests.
- Document the behavior for failed, stopped, and error phases.
Acceptance Criteria
- Polling continues while an experiment run is in a non-terminal phase.
- Polling stops when a documented terminal phase is reached.
- The final
ExperimentRunresponse is returned as documented. - A clear exception is thrown when the timeout is exceeded.
- The polling interval and timeout are configurable with
Duration. - Unit tests cover terminal completion and timeout behavior.
- JavaDoc documents terminal and unsuccessful phase handling.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main/java/io/litmuschaos/LitmusClient.java by reading getExperimentRun() and the ExperimentRun phase representation. Then inspect the existing unit-test structure before adding tests for terminal completion and timeout behavior. Done means the new API, polling helper, JavaDoc, documented phase handling, and configurable Duration timeout and interval are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100