Skip to content
Skills Library
DevOps & cloud · Testing

skaffold-testing

/skaffold-testing

Container image validation with Skaffold test/verify stages — container-structure-tests, security scans. Use when configuring pre-deploy tests or integration tests in Skaffold.

Licence
MIT
Last repository change
24.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Container image validation with Skaffold test/verify stages — container-structure-tests, security scans. Use when configuring pre-deploy tests or integration tests in Skaffold.

Original author description

Container image validation with Skaffold test/verify stages — container-structure-tests, security scans. Use when configuring pre-deploy tests or integration tests in Skaffold.

How it works

  1. When to Use This Skill
  2. Testing Lifecycle
  3. Test Stage Overview
  4. Container Structure Tests
  5. Custom Tests
  6. Verify Stage (Post-Deploy)
  7. Agentic Optimizations
  8. Quick Reference
Original SKILL.md headings · 157 lines, 596 words
SKILL.md preview
---
name: skaffold-testing
description: "Container image validation with Skaffold test/verify stages — container-structure-tests, security scans. Use when configuring pre-deploy tests or integration tests in Skaffold."
user-invocable: false
allowed-tools: Bash, Read, Write, Edit, Grep, Glob, TodoWrite
created: 2025-12-23
modified: 2026-05-09
reviewed: 2025-12-23
---

# Skaffold Testing

## When to Use This Skill

| Use this skill when... | Use another skill instead when... |
|------------------------|-----------------------------------|
| Configuring container-structure-tests | Writing Dockerfiles (use container skills) |
| Adding security scans to Skaffold pipelines | General Skaffold build/deploy (use skaffold-development) |
| Setting up post-deploy verification | Unit testing application code |
| Validating image contents pre-deploy | Kubernetes manifest authoring |

## Testing Lifecycle

```
Build -> Test -> Deploy -> Verify
          ^                  ^
     Pre-deploy         Post-deploy
```

| Stage | Purpose | Runs During |
|-------|---------|-------------|
| **test** | Validate images before deployment | `dev`, `run`, `test` |
| **verify** | Validate deployment works correctly | `dev`, `run`, `verify` |

Failed tests block deployment. Use `--skip-tests` to bypass.

## Test Stage Overview

Two mechanisms for pre-deploy validation:

| Type | Purpose | Tool Required |
|------|---------|---------------|
| **structureTests** | Validate image contents | `container-structure-test` binary |
| **custom** | Run arbitrary commands | None (uses `$IMAGE` env var) |

## Container Structure Tests

Validate image contents without running the container.

### Configuration

```yaml
apiVersion: skaffold/v4beta11
kind: Config
test:
  - image: my-app
    structureTests:
      - ./tests/structure/*.yaml
    structureTestsArgs:
      - --driver=tar      # Faster, no Docker daemon needed
      - -q                # Quiet output
```

### Test Types Summary

| Type | Purpose | Key Fields |
|------|---------|------------|
| **commandTests** | Verify binaries work | `command`, `args`, `expectedOutput`, `exitCode` |
| **fileExistenceTests** | Verify files present/absent | `path`, `shouldExist`, `permissions`, `uid`, `gid` |
| **fileContentTests** | Validate file contents | `path`, `expectedContents`, `excludedContents` |
| **metadataTest** | Validate image config | `envVars`, `user`, `entrypoint`, `cmd`, `exposedPorts`, `workdir` |

## Custom Tests

Run arbitrary commands with access to built image via `$IMAGE` env var.

```yaml
test:
  - image: my-app
    custom:
      - command: grype $IMAGE --fail-on high --only-fixed
        timeoutSeconds: 300
      - command: trivy image --exit-code 1 --severity HIGH,CRITICAL $IMAGE
        timeoutSeconds: 300
```

### Dependencies

Control when tests re-run:

```yaml
custom:
  - command: ./scripts/integration-test.sh
    timeoutSeconds: 600
    dependencies:
      paths:
        - "src/**/*.go"
        - "go.mod"
      ignore:
        - "**/*_test.go"
```

## Verify Stage (Post-Deploy)

Run integration tests after deployment succeeds.

### Execution Modes

| Mode | Environment | Use Case |
|------|-------------|----------|
| `local` (default) | Docker on host | Quick tests, local dev |
| `kubernetesCluster` | K8s Job | Integration tests needing cluster access |

### Basic Configuration

```yaml
verify:
  - name: health-check
    container:
      name: curl-test
      image: curlimages/curl:latest
      command: ["/bin/sh"]
      args: ["-c", "curl -f http://my-app.default.svc:8080/health"]
    executionMode:
      kubernetesCluster: {}
```

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Quick structure test | `container-structure-test test --driver=tar -q --image $IMAGE --config tests/structure/security.yaml` |
| Security scan (critical only) | `grype $IMAGE --fail-on critical -q` |
| Skip tests in dev | `skaffold dev --skip-tests` |
| Run only tests | `skaffold test` |
| Run only verify | `skaffold verify` |
| CI with JUnit output | `container-structure-test test --image $IMAGE --config test.yaml --test-report junit.xml` |

## Quick Reference

### Container Structure Test Flags

| Flag | Description |
|------|-------------|
| `--driver=tar` | Use tar driver (faster, no Docker daemon) |
| `--driver=docker` | Use Docker driver (default) |
| `-q` | Quiet output |
| `--test-report FILE` | Generate test report |
| `--output json` | JSON output format |

### Skaffold Test Flags

| Flag | Description |
|------|-------------|
| `--skip-tests` | Skip test phase |
| `-p PROFILE` | Use specific profile |
| `--build-artifacts FILE` | Use pre-built artifacts |

### Custom Test Environment

| Variable | Description |
|----------|-------------|
| `$IMAGE` | Built image with tag/digest |

For detailed examples, advanced patterns, and best practices, see [REFERENCE.md](REFERENCE.md).
Files in this package (2)
  • REFERENCE.md 9 KB
  • SKILL.md 5 KB

Versions

The database has no other skills named skaffold-testing.

Database snapshot: 13.11.2026 · package version 7d6a0f5d86ef (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100configure-skaffold
    Skaffold for Kubernetes: port forwarding, dotenvx hooks, API version. Use when fixing 0.0.0.0 binding, adding secret generation hooks, or creating skaffold.yaml.
  • 95skaffold-filesync
    Skaffold file sync — copy changed files to containers without rebuilding. Use when optimizing the dev loop, configuring sync rules, or the user mentions hot reload or fast iteration.
  • 100check-integration-tests
    Check Konflux integration test status and results. Lists test runs, gets results, shows snapshots. Use when user says "check integration tests", "integration test status".
  • 100testcontainers-integration-testing-configuration
    Guides configuring Testcontainers to spin up real dependency containers (Postgres, Kafka, Redis, and similar) for integration tests instead of mocks or hand-maintained shared test environments — container lifecycle management (per-test vs. shared/singleton containers), wait…
  • 100testing
    Apply comprehensive testing best practices including unit, integration, and e2e tests. Use when writing tests, reviewing test coverage, designing testable code, or setting up test infrastructure.
  • 100docker-review
    Review Dockerfiles, container images, and Compose files as a senior container engineer, then produce a prioritized, evidence-based findings table and self-contained remediation plans covering image size, build speed, security, and correctness. Strictly read-only — inspects and…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.