Skip to content

feat: Add experiment run polling helper #58

Description

@rowing0328

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions