一键导入
running-task-tests
Use when running, writing, or troubleshooting functional tests for Tekton tasks in this catalog
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when running, writing, or troubleshooting functional tests for Tekton tasks in this catalog
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when confused by CI behavior, investigating why tests did or did not run, or troubleshooting GitHub Actions workflows
Use when a Tekton task test fails in CI or locally and you need to find the root cause
Use when preparing, reviewing, or finalizing a pull request to this Tekton catalog repository
Use when setting up or tearing down a local kind cluster for running Tekton task tests
| name | running-task-tests |
| description | Use when running, writing, or troubleshooting functional tests for Tekton tasks in this catalog |
Tests are Tekton Pipelines that exercise a task on a kind cluster with Konflux CI. The test runner creates a namespace, applies the task, and runs each test pipeline via tkn p start.
yamllint . directly)| Action | Command |
|---|---|
| Run tests for one task | .github/scripts/test_tekton_tasks.sh tasks/<cat>/<name>/<ver> |
| Run a single test file | .github/scripts/test_tekton_tasks.sh tasks/<cat>/<name>/<ver>/tests/test-<name>-pass.yaml |
| Run multiple tasks | .github/scripts/test_tekton_tasks.sh <dir1> <dir2> ... |
Prerequisites: kind cluster with Konflux CI, plus tkn, kubectl, yq, jq on PATH.
tasks/<category>/<name>/<version>/tests/
test-<name>-pass.yaml # Positive test (required)
test-<name>-fail.yaml # Negative test (recommended)
pre-apply-task-hook.sh # Optional cluster setup
Pipeline succeeds with valid inputs:
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-<task-name>-pass
spec:
tasks:
- name: run-<task-name>
taskRef:
name: <task-name>
params:
- name: param1
value: "valid-value"
Annotate which task should fail:
metadata:
name: test-<task-name>-fail
annotations:
test/assert-task-failure: "run-<task-name>"
The runner verifies the pipeline failed at the annotated task, not earlier.
pre-apply-task-hook.sh receives $1 (task YAML path) and $2 (test namespace). Use it for ConfigMaps, Secrets, PVCs, Deployments, or RBAC the task needs.
| Mistake | Fix |
|---|---|
| Tests share PVC data path | Each test must use a unique path (e.g. test-repo-pass, test-repo-fail) |
No tests/ directory | CI silently skips the task — no gate, no coverage |
Wrong test/assert-task-failure value | Must match the pipeline task name, not the taskRef |
Missing appstudio-pipeline SA | Runner creates it, but hooks adding RoleBindings must reference it correctly |
Reference implementation: tasks/linters/yamllint/0.1/ — has positive test, negative test, pre-apply hook with git-daemon service, and PVC-based data sharing.