跳到正文
cccskills
免费在 GitHub 公开

api-chaos-runner

Runs the project's existing API tests under injected network chaos - latency, timeouts, dropped connections, bandwidth caps, packet loss - via Toxiproxy (notes on Pumba / Gremlin / LitmusChaos). Builds a per-scenario chaos matrix and reports which assertions break under which conditions, verifying resilience patterns (retry, circuit-breaker, timeout, fallback). Unlike schemathesis-fuzzing and restler-fuzzing, which generate new tests from a schema, this drives your EXISTING example-based suite.

中文简介正在准备中。当前显示原文说明。

testland/qa星标 13(GitHub 13 + cccskills 0)

实测评分 未实测

查看安装方法

包含的文件(3)

  • SKILL.md11.1 KB
  • .tessl-plugin/plugin.json631 B
  • references/toxiproxy-wiring.md2.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

api-chaos-runner

Overview

Most API tests run against perfect networks: <1ms latency, no packet loss, infinite bandwidth, deterministic ordering. Real production isn't like that. Network chaos testing drives the existing tests under controlled network impairment - the team discovers which retry / circuit-breaker / timeout patterns actually hold up before real customers find out.

The canonical open-source primitive is Toxiproxy - Shopify's "TCP proxy to simulate network and system conditions for chaos and resiliency testing" (toxiproxy-readme). The pattern: sit Toxiproxy between client and upstream; manipulate toxics (latency, timeout, bandwidth, etc.) during test execution.

This skill is build-an-X - the workflow chains the team's existing API tests (Postman / Karate / RestAssured / Tavern / Schemathesis) through a Toxiproxy-managed connection and orchestrates a per-scenario chaos matrix.

When to use

  • The API has documented resilience requirements (retry on 5xx, circuit-break on 3 consecutive failures, timeout at 5s, etc.) and the team needs to verify them, not just document them.
  • A new external dependency just got added; the team wants to pressure-test fallback behavior.
  • An incident postmortem identified a "we should have caught this in testing" item; chaos coverage is the prevention mechanism for that class.
  • The team has integration tests already and wants to multiply their signal value via fault injection.

If the team is just starting API testing and has no resilience patterns to verify, this skill is overkill - start with happy-path coverage via postman-collections or the language-native equivalents first.

How to use

  1. Confirm documented resilience requirements exist (retry, circuit-breaker, timeout, fallback). If none, start with happy-path coverage instead of chaos.
  2. Pick the chaos primitive - Toxiproxy for per-API chaos in CI (Step 1).
  3. Build the chaos matrix: for each existing test scenario, list the toxics to inject and the expected behavior per condition (Step 2).
  4. Wire Toxiproxy between the app and its upstream and register a proxy per dependency (references/toxiproxy-wiring.md).
  5. Run the matrix, always including a no-toxic control row; capture one JUnit XML per scenario (Step 3).
  6. Aggregate results into a resilience matrix and report which assertions break under which toxic (Step 4).
  7. Inject only toxics that map to a documented expectation; run the full matrix nightly, the control row per PR.

Step 1 - Pick the chaos primitive

ToolLayerBest for
ToxiproxyTCP proxyPer-connection latency / bandwidth / timeout / drop. Most precise.
PumbaDocker containerContainer-level chaos (kill, pause, network).
Gremlin (commercial)Multi-platformProduction-grade chaos with audit / approval flow.
LitmusChaosKubernetes operatorCloud-native; experiments declared as CRDs.
tc qdisc (Linux native)Network interfaceLowest level; most setup; CI-friendly only with --cap-add NET_ADMIN.

Default recommendation: Toxiproxy for per-API chaos in CI. The others fit when the team is already in those ecosystems (Docker-Compose-heavy projects, Kubernetes-first projects).

Step 2 - Define the chaos matrix

For each existing API test scenario, define a matrix of conditions to run it under:

ScenarioToxicExpected behavior
Order create (POST /orders)None (control)201 in <500ms
Order createlatency=1000ms201 in <2s (within timeout budget)
Order createlatency=10000ms504 with retry-after, OR client gives up
Order createbandwidth=10kbps201 (eventual) OR 408 timeout
Order createreset_peer502 with retry attempted
Order createtimeout504; circuit-breaker opens after 3rd

Per toxiproxy-readme, the canonical toxic types include latency, down (forced failure), bandwidth, slow_close, timeout, slicer, limit_data, reset_peer.

The matrix is the load-bearing artifact: what the team expects under each condition is what differentiates resilience verification from "did the test pass?" The Expected column drives the assertions.

Step 3 - Wire Toxiproxy and run the matrix

Sit Toxiproxy between the app and its upstream, register a proxy per dependency, and add/remove toxics around each test run. Point the app at Toxiproxy's listen ports; it forwards to the real upstream when no toxic is active. A matrix runner loops the scenarios, adding one toxic per row and producing one JUnit XML per scenario to aggregate in the report stage.

Full docker-compose setup, control-API proxy registration, toxiproxy-cli toxic commands, and the runner shell script: references/toxiproxy-wiring.md.

Step 4 - Report what broke under what

A successful chaos run produces a resilience matrix report:

## API Chaos Matrix - verdict: REVIEW

| Scenario         | Control | Latency 1s | Bandwidth 10k | Timeout 5s | Reset peer |
|------------------|:-------:|:----------:|:-------------:|:----------:|:----------:|
| POST /orders     |    ✅   |     ✅     |       ✅      |     ✅     |     ❌     |
| GET /orders/:id  |    ✅   |     ✅     |       ❌      |     ✅     |     ✅     |
| DELETE /orders/:id |  ✅   |     ✅     |       ✅      |     ✅     |     ✅     |

### Failures

| Test | Toxic       | Expected                                          | Actual |
|------|-------------|---------------------------------------------------|--------|
| POST /orders | reset_peer | 502 + retry attempted; second attempt succeeds | 502; no retry observed in client logs |
| GET /orders/:id | bandwidth=10k | 200 in <30s | 408 timeout at 10s |

A green matrix isn't the goal - finding where resilience is missing is the goal. A failure under a chaos scenario is a feature request, not a bug in the test.

Choosing what to inject

Match toxics to documented resilience requirements:

Resilience pattern documentedToxic to inject
Retry on 5xxdown (forced 5xx) or reset_peer
Timeout after Nmslatency=N+500 (force the timeout)
Circuit-breaker after 3 failuresdown for ≥3 requests
Fallback to cache when upstream unreachabledown indefinitely
Bulkhead under loadbandwidth=very-low
Slow-loris clientslow_close on response

Run only the toxics that map to a documented expectation; running every toxic against every endpoint is noise.

Worked example

The orders service documents "retry once on connection reset." The team already has a Postman collection covering POST /orders.

  1. Wire Toxiproxy in front of orders-api-real and register the orders-api proxy (Step 3).
  2. Matrix rows: control (no toxic) and reset_peer. Expected for reset_peer: 502, retry attempted, second attempt succeeds.
  3. Run the matrix. Control passes - 201 in <500ms.
  4. Under reset_peer the run returns 502 with no retry in the client logs, so POST /orders reset_peer is marked failing in the matrix.

Verdict: REVIEW. The documented retry policy is not actually implemented. The output is a fix request against the client (add the retry), not a bug in the test - exactly the resilience gap the matrix exists to surface.

Anti-patterns

Anti-patternWhy it failsFix
Chaos in productionReal users observe; oncall pages.CI / staging only. Production chaos requires the team's full chaos engineering practice (Gremlin / Litmus + approval flow).
Per-PR chaos matrixAdds 10+ minutes; team disables.Nightly chaos runs; PR runs only the control row.
Asserting "chaos must not break anything"Every system has a breaking point; the test trivially fails.Assert specific resilience behavior under specific conditions; document the breaking point as accepted.
Using down for everythingdown forces 5xx; doesn't model real-world latency / bandwidth.Mix latency, bandwidth, timeout, reset_peer for realistic mixes.
Skipping the control rowWithout control, the matrix can't distinguish chaos failures from test bugs.Always run a no-toxic scenario as the baseline.

Limitations

  • Toxiproxy is TCP-level. UDP flaws (DNS resolver weirdness, QUIC) need different tooling.
  • Doesn't model partial failures within a single connection. Toxiproxy treats each connection uniformly; for "retry on the 3rd request after 2 successes" patterns, layer a counting middleware.
  • Per-test-suite isolation. When tests run in parallel against the same Toxiproxy instance, they fight over the same toxic state; serialize chaos scenarios or use one Toxiproxy instance per worker.

References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Builds a CI gate that fails the build on **new** WCAG / a11y violations introduced by a PR while grandfathering pre-existing violations on a per-rule / per-page baseline. Aggregates verdicts from axe-core / pa11y / Lighthouse a11y / WAVE / IBM Equal Access scans. Use when a project has accumulated a11y debt and a strict "zero violations" gate would block every PR - the ratchet pattern lets the team ship while preventing regressions.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

Workflow skill that builds an A/B-test validity checklist from an experiment proposal, walking the canonical design-correctness gates - pre-registered OEC/power/guardrails, randomization unit + SRM check, assignment integrity, telemetry, peeking discipline, novelty/primacy, post-experiment SRM re-check - into a per-experiment checklist + sign-off form. Use when launching, auditing, or governing an experiment. For pitfall mechanics (guardrails, peeking) see experiment-results-interpreter's references; to read an already-valid result use experiment-results-interpreter; for per-SDK harness tests use experiment-sdk-testing - this gates DESIGN, not SDK code.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

The single install-flow skill: the reference contract for the PWA install flow (installability gate fields, `beforeinstallprompt` handshake, per-platform paths - Android WebAPK / iOS Share menu / Firefox no-op - and the `display-mode` post-install signal, in references/install-flow-reference.md) plus the build-an-X workflow that emits the Add-to-Home-Screen suite. Walks the four-stage timeline, emitting one test per gate cell per [web.dev/articles/install-criteria][install-criteria], the deferred-prompt → `prompt()` → `userChoice` chain per [web.dev/articles/customize-install][customize-install], the iOS Safari manual-metadata branch (`apple-touch-icon`) per [web.dev/learn/pwa/installation][learn-pwa], and the post-install `(display-mode: standalone)` MQ assertion. Output: a Playwright spec with per-stage cells plus a coverage matrix. Use when a PWA's manifest, icons, or install handler change, when install conversion drops at an unknown stage, or when triaging a flaky install assertion.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

Build-an-X workflow that uses an LLM to map existing tests to spec sections - given a spec doc + the test suite, the LLM identifies which tests cover which sections, surfaces uncovered sections (gap), and recommends specific tests to add. Output is a coverage matrix per spec ID. Scope is mapping tests that already exist and naming the gaps, not authoring tests for new acceptance criteria. Use when a spec doc and a test suite both exist but nobody can say which requirements are actually covered - before a release sign-off, an audit, or a decision about where to spend the next round of test effort.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

Generates tests from natural-language specs (acceptance criteria, user stories, requirements) using an LLM, with confidence scoring per test case (LLM self-assessment plus heuristics: assertion quality, naming, completeness), batching uncertain cases for human review, and integration with the team's existing test framework. Use when the user asks to generate unit tests from acceptance criteria, convert user stories to test cases, automate test creation from requirements, or augment a spec-driven test suite with AI-generated stubs that are then curated before merge.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

Configures Allure Report (test-runner adapter install, `allure-results` directory wiring, `categories.json` for failure classification, `history-trend.json` retention via the copy-history-between-runs pattern), runs the Allure CLI to convert `allure-results` to a static HTML site, and uploads the report as a CI artifact. Use when the team needs richer test reporting than JUnit XML - step-level attachments, per-test history, retry tracking, and severity / epic / feature labeling across framework-agnostic adapters (pytest, Jest, JUnit, TestNG, NUnit, Mocha). As a rich static HTML report generator, it is the open-source alternative to the sunset ExtentReports (JVM/.NET per-test HTML narrative); for hosted cross-run flakiness analytics rather than a static per-run report use currents-integration.

中文简介正在准备中。当前显示原文说明。

testland/qa132026年10月20日 更新

查看 testland 的全部技能

报告此技能的问题