Advanced
Searching inSummaries
How to search
  • Words find lesson titles, text and code. Filter by type (guides, courses, programs, books) or stay in this book.
  • book:rhcsa and ch:8 narrow the search; #code finds a word only in commands of the lessons.
  • "two words" finds the exact phrase.
  • Plain words find names, texts and examples.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search
Try:

Chapter 6Name in the course: Posts P1022–P1031

Testing

Ten posts (P1022–P1031) about Testing, each in one lesson: the main idea, the key points and a link to the full note with all details, the PDF field guide and the commands.

  • 11 Lessons
  • 3 Commands
  • 1 Labs

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Testing — P1022–P1031

6.1

A test pyramid that matches the risk

Risk picks the layer.

The test pyramid is usually drawn as a ratio. A better use is as a budget: each layer exists because a different failure is cheapest to catch there.

  • Critical Path: Critical journeys, Smoke after deploy, Revenue flow
  • Service Boundary: Consumer pact, Schema check, Provider verify
  • Unit Logic: Pure functions, Edge cases, Fast suite

Full note: P1022 — A test pyramid that matches the risk

6.2

Contract testing between services

Contract testing answers a narrow question: whether the provider still sends what this consumer needs. It does not test the business logic on either side, and it does not replace an end-to-end journey. That narrowness is the point.

  • One consumer, one promise: The fields, paths and status codes that consumer actually reads.
  • A pact, not a schema: A small JSON record of the request and the response it needs.
  • Verify the provider: Replay every pact against a real build, with the state set up.
  • Gate the deploy: Publish the result and ask can-i-deploy before the release.

Full note: P1023 — Contract testing between services

6.3

Five test smells that hide bugs

Five smells show up in suites that are green and still hide bugs.

  • A mock assertion proves the wiring, not the behaviour.
  • A fixed sleep hides the race it was meant to fix, and slows the suite.
  • A shared fixture that mutates makes test order a hidden dependency.
  • Twenty assertions in one test tell you it broke, not what broke.

Full note: P1024 — Five test smells that hide bugs

6.4

Tests in CI: lint, unit, contract, e2e, gate

A pipeline is a gate, not a suggestion.

Most CI pipelines run tests. Fewer run them in an order that fails fast and tells you why.

  • Lint and types: Style, types and secrets fail before a single test runs.
  • Unit: Isolated, parallel, under a minute on a warm cache.
  • Contract: Consumer expectations against a real provider build.
  • E2E: A few critical journeys on a seeded environment.

Full note: P1025 — Tests in CI: lint, unit, contract, e2e, gate

6.5

Test data you can trust

Test data is the part of the suite nobody owns until it breaks. A test fails because a row changed, a date moved or another job deleted a fixture.

  • Build, do not copy: Factories that make the smallest valid row, with explicit overrides.
  • Isolate the state: A transaction or a schema per worker, from the production migrations.
  • Freeze the inputs: Clock, seed and ids controlled so a failure reproduces.
  • Protect the data: Synthetic by default; masked copies have an owner and a date.

Full note: P1026 — Test data you can trust

6.6

Four numbers worth tracking

Four numbers say more than a coverage badge.

  • Coverage shows what ran, not what was checked. Watch the trend, not a target.
  • Flake rate counts tests that fail, then pass on a rerun with no code change.
  • Runtime: keep the fast suite local and the full suite inside the merge window.
  • Escaped defects: bugs found after release. The only number tied to outcomes.

Full note: P1027 — Four numbers worth tracking

6.7

Quarantine a flaky test, keep coverage

A skip is a loan, not a fix.

A flaky test is one that fails and passes on the same commit. The worst response is to delete it, because the coverage goes with it and the bug it was hinting at stays.

  • Prove it is flaky, not broken: Read the rerun log; Name the failure mode; Open one ticket.
  • Skip it in the open: Skip it by name; Pin it to an owner; Keep a shadow run.
  • Fix the cause, then unskip: Reproduce with a seed; Fix the cause, not the wait; Unskip on green.

Full note: P1028 — Quarantine a flaky test, keep coverage

6.8

Load testing a design, not a number

A load test that reports ten thousand requests per second has told you a number, not whether the design survives your traffic.

  • Ask a question: An SLO, a pass condition and a stop condition before the script.
  • Model the mix: Endpoints, ratio, payloads and arrival shape from real traffic.
  • Read the tail: p50, p95, p99 and the error rate; find the knee, not the peak.
  • Keep it repeatable: Versioned script, pinned tool, raw output and run notes.

Full note: P1029 — Load testing a design, not a number

6.9

Five accessibility checks before release

Accessibility checks are cheaper before release than after a complaint, and five of them need no specialist tool.

  • Keyboard: every control reachable, in order, with focus always visible.
  • Names: every input has a label and every icon button a name.
  • Contrast: 4.5:1 for body text, 3:1 for large text and controls.
  • Zoom: 200 per cent with no clipped or overlapping text.

Full note: P1030 — Five accessibility checks before release

6.10

Security tests every pipeline should run

A scan is a starting point.

Every pipeline should run a small set of security tests. The list is short because a check nobody triages is worse than no check at all.

Full note: P1031 — Security tests every pipeline should run

Practice

All commands in this chapter