# Test Format

> Pipeline-level test discovery, environment variables, parameters, and group snapshot handling.

---

LLMS index: [llms.txt](https://hummingbird-project.io/llms.txt) | Full content: [llms-full.txt](https://hummingbird-project.io/llms-full.txt)

---

## Test Discovery

The pipeline locates `tests-k8s.yml` using `source.git.context` from the
Konflux Snapshot. For example, if `source.git.context` is `images/curl`, the
pipeline looks for `images/curl/tests-k8s.yml` in the source tree.

When `source.git.context` is not populated (currently the case for the
triggering component in PR-triggered pipelines, tracked as
[KONFLUX-12674](https://issues.redhat.com/browse/KONFLUX-12674)), a heuristic
fallback derives the context from the component name: it tries `images/<base>`
and then `<base>`.

The actual `tests-k8s.yml` format is opaque to the pipeline — it is passed
to the repository's test runner script, which defines the structure and
semantics. See the respective repository documentation for the YAML format.

## Environment Variables

The test runner receives these variables from the pipeline:

| Variable           | Description                                                |
| ------------------ | ---------------------------------------------------------- |
| `TEST_IMAGE`       | Container image under test (with digest)                   |
| `TEST_GROUP`       | Image group name (e.g., `git`, `postgresql`)               |
| `TEST_VARIANT`     | Variant being tested (e.g., `default`, `builder`)          |
| `KUBECONFIG`       | Path to kubeconfig for the ephemeral namespace             |
| `TEST_IMAGES`      | Bash associative array of all images in the snapshot       |
| `TEST_IMAGES_PATH` | Path to source `TEST_IMAGES` in external scripts           |
| `TEST_RUN_ID`      | Unique ID for this test run (for resource naming)          |
| `TEST_RUN_LABEL`   | Label selector for cleanup (e.g., `hum-k8s-test=<id>`)     |
| `test_fail`        | Shell function — call `test_fail "message"` to fail a test |

## Pipeline Parameters

| Parameter                     | Description                                                                          | Default                  |
| ----------------------------- | ------------------------------------------------------------------------------------ | ------------------------ |
| `SNAPSHOT`                    | Konflux snapshot JSON or snapshot name (with `snapshot-param-as-name` annotation)    | —                        |
| `EXTRA_SINGLE_COMPONENT_ARGS` | Additional arguments appended to the test runner for single-component (PR) snapshots | `--include-reverse-deps` |

## Group Snapshot Handling

For group snapshots (post-merge), the pipeline exports:

- `IMAGE_NAMES` — space-separated list of all component names
- `IMAGE_URL_<COMPONENT>` — image URL for each component (name uppercased,
  dashes replaced with underscores)

The test runner script is called once with multiple `--group-component-name`
arguments. Test discovery checks all components for `tests-k8s.yml`. Source is
fetched from the first component's build attestation (shared source tree).
