konflux-ci/capo/testing
Claude Code and agent skill by konflux-ci/capo
- community
Checking that the SKILL.md file is still in the repository.
Use when writing new unit or integration tests for capo, adding test cases to integration_test.go, structuring test expectations with PackageMetadataItem, or choosing between unit and integration test scope
Install
npx vskill@latest install konflux-ci/capo/testingSKILL.md
Testing
Overview
Capo uses build-tag-separated test suites: //go:build unit for fast tests without buildah, //go:build integration for almost end-to-end tests that build real container images and scan them.
When to Use
- Adding a new test case for a Containerfile pattern
- Verifying capo output for a new COPY/mount scenario
- Unsure whether to write a unit or integration test
Unit vs Integration
| Aspect | Unit (//go:build unit) | Integration (//go:build integration) | |
|---|---|---|---|
| Run with | mage test | mage integrationTest | |
| Needs buildah | No | Yes (>= 1.44.0) | |
| Tests what | Parsing, source tracing, path matching | Full build-scan-compare cycle | |
| Location | pkg/*_test.go per package | pkg/integration_test.go | |
| Pattern | Table-driven map[string]struct{} | TestCase with BuildDefinition |
Rule of thumb: if it needs buildah build or storage.Store, it's integration. Everything else is unit.
Adding an Integration Test
- Add entry to
testCasesmap inTestIntegration:
- Key fields:
Tag— auto-normalized (addslocalhost/,:latestif missing)ContainerfileContent— inline only, no file pathsContextDirectory— relative topkg/, typically../testdata/image_contentPullspecin expected — use@sha256:dummy, digests are stripped during comparison
- Comparison uses
go-cmpwith:
cmpopts.SortSlices— order-independent matching onPackageURLcmpopts.EquateEmpty— nil and empty slices are equalcmp.FilterPathonPullspec— strips digests before comparing
Where to Add Tests
| Change type | Test location | |
|---|---|---|
| Containerfile parsing logic | pkg/containerfile/containerfile_test.go | |
| Source tracing behavior | pkg/scan_test.go | |
| Content extraction logic | pkg/integration_test.go | |
| Buildprobe behavior | pkg/probe/probe_test.go | |
| Build arg handling | pkg/buildargs/buildargs_test.go | |
| Bug fix | Test that reproduces the bug before the fix |
Bug Fix Workflow
Always use test-driven approach for bug fixes:
- Write a failing test first — reproduce the bug with a test case that fails on the current code
- Verify the test fails — run
mage testand confirm the failure matches the reported bug
(redirect test logs to file for better readability and audit purposes)
- Fix the bug — make the minimal change to fix the issue
- Verify the test passes — run
mage testagain, the previously failing test should now pass - Check for regressions — run
mage lintandmage integrationTestif applicable
Never fix first and test later — writing the test first ensures you understand the bug and that the fix actually addresses it.
Common Mistakes
- Missing
//go:build unitor//go:build integrationtag — tests won't run - Forgetting
exclude_graphdriver_btrfs— handled by mage, but breaks with rawgo test - Missing
BuilderImages— builder base must exist in storage before test image build - Using file paths in
ContainerfileContent— only inline content works
Additional Resources
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/testing/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/konflux-ci/capo/testing)