litmuschaos / litmuschaos/litmus-java-sdk

feat: Add experiment run polling helper

Open
#58 0 comments 0 reactions 0 assignees View on GitHub

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() to src/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 ExperimentRun response 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 ExperimentRun response 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.