Skip to content

feat: [CHAOS-12655]: Add RT (Resilience Testing) CLI support for loadtesting capabilities - #131

Open
uditgaurav wants to merge 1 commit into
harness:mainfrom
uditgaurav:chaos-12655
Open

feat: [CHAOS-12655]: Add RT (Resilience Testing) CLI support for loadtesting capabilities#131
uditgaurav wants to merge 1 commit into
harness:mainfrom
uditgaurav:chaos-12655

Conversation

@uditgaurav

Copy link
Copy Markdown

Add RT (Resilience Testing) CLI support for load testing

What this is

Adds rt — the Resilience Testing module — to the Harness CLI. Load testing had no CLI
surface at all before this; you could only drive it from the console.

41 commands over 41 distinct LTM REST routes, covering the full lifecycle: define a load
test, attach a script, run it, watch it, and read the results.

RT is the module. loadtest is the noun you type — load testing is the first feature area
under RT, and chaos is expected to land alongside it, so nothing in the module assumes load
tests are all it holds.

harness list loadtest
harness execute loadtest checkout-peak --set targetUsers=200 --follow
harness get loadtest_run:summary checkout-peak-a7f

Scope

Deliberately minimal footprint outside the module:

Path Change
pkg/spec/rt.spec.yaml new — all 41 commands
modules/rt/ new — 838 lines of Go, 1670 lines of tests
cmd/harness/main-harness.go +2 lines — the standard module registration

Nothing else is touched. No framework changes, no shared-file edits.

Command surface

All 41 commands

loadtest (11) — list · get · create · create:from_json · create:from_template ·
update · update:json_spec · delete · list:variables · execute:sync · execute

loadtest_run (10) — list · get · update · execute:stop · execute:rerun ·
get:summary · list:metrics · list:graph · list:requests · list:endpoints

loadtest_script (4) — get · update · list:revisions · get:revision

loadtest_template (11) — list · get · create · update · delete ·
list:revisions · create:revision · get:revision · delete:revision ·
list:variables · get:yaml

composite_loadtest (2) — list · create

loadtest_usage (3) — list · get · get:report

harness get module rt prints the domain model and the full command list — no credentials
needed, and it is probably the fastest way to review the surface.

What is in Go, and why

39 of the 41 commands are declarative endpoint: blocks in the spec. modules/rt/ holds only
what YAML cannot express:

Handler Why it cannot be declarative
start_run The server wants a client-supplied run identity, and run-time overrides as a values[{name,value}] array rather than a flat object
encode_script Scripts are stored base64-encoded; the framework's -f handling sends the file as-is
composite_body Composite create keys on identifier (not identity) and rejects hyphens server-side with an HTTP 500 quoting a pipeline rule that names no argument — checked client-side first
watch (--follow) Polls to a terminal state, exits non-zero on failure so a gating pipeline step fails too. Timeline goes to stderr, so --follow --format json > run.json still yields one document
rerun There is no rerun route — reads the previous run for its load test, then starts a new one
template:yaml The route answers application/x-yaml, which the shared client's unconditional json.Unmarshal cannot decode
usage:report The route returns a bare matrix, not objects; reshaped into rows so --format/--columns work
loadtest_filters --tag is repeatable, and a list flag in query_params ships as the literal "[]" when unset — the API reads that as a tag nothing carries and returns an empty page, silently

Testing

  • modules/rt coverage: 96.0%, via a fake-server harness (apitest_test.go) that spins an
    httptest server against a real registry, so ModuleInit wiring is exercised rather than
    mocked.

  • Live-verified against QA (account DSzI0EehTMqGVdfsfG3a5g): the read paths on this exact
    build — list loadtest, list loadtest_run, get loadtest_run:summary, get loadtest_usage.

  • Write paths (create / update / delete / execute) are covered by unit tests and were
    verified live during earlier QA rounds against the pre-rename shape.

  • gofmt, go vet, full go test ./... and HARNESS_CHECKSPECS=1 all clean.

Notes for reviewers

  • Naming. Nouns are not module-prefixed, following iacmworkspace and code
    repository. gitops is the counter-example if you would rather see rt_loadtest; happy to
    switch, it is a mechanical change.
  • URL paths and wire fields keep the server's spelling (/load-tests, loadTestIdentity)
    while everything user-facing is loadtest. That asymmetry is intentional, not an oversight.

… testing capabilities

Signed-off-by: Udit Gaurav <udit.gaurav@harness.io>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mohitsuman

Copy link
Copy Markdown
Collaborator

Thanks for raising the PR @uditgaurav . Team will be reviewing this soon.
We would also need to add more capabilities of Chaos in the CLI (as separate PRs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants