Integrating KubeAssert with KUTTL

About KUTTL

Combine KUTTL with KubeAssert

apiVersion: v1
kind: Pod
metadata:
name: my-pod
status:
phase: Successful

Writing Your First Test using KUTTL and KubeAssert

Create a Test Case

mkdir -p tests/e2e/example-test
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- command: kubectl assert exist-enhanced deployment example-deployment -n $NAMESPACE --field-selector status.readyReplicas=3

Write a Second Test Step

apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
spec:
replicas: 4
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- command: kubectl assert exist-enhanced deployment example-deployment -n $NAMESPACE --field-selector status.readyReplicas=4
kubectl kuttl test — start-kind=true ./tests/e2e/

Summary

--

--

--

Life is coding and writing! I am a software engineer who have been in IT field for 10+ years. I would love to write beautiful code and story for people.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

More focus on business value with cloud-native architecture and serverless software

Flutter: Funny handwriting animation

A Workflow for Making 5-Minute Podcasts

How I learned 15 programming languages, and why your children will too

Ruby: Change the start value of Array index

SE-FT Blog #1: “Why did you get into software engineering”

SPRING 2022 WP2: THE ARCHIVE

KM Component 38: Archiving, Document Management, and Records Management

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MorningSpace

MorningSpace

Life is coding and writing! I am a software engineer who have been in IT field for 10+ years. I would love to write beautiful code and story for people.

More from Medium

Argo CD Deals With Our First Zero-Day CVE

Installing Istio, Prometheus, Kiali, Jaeger and Grafana as Istio addons and enabling Istio Rolling…

Helm 3.8.0 — OCI Registry Support

Managing Vault Secrets using Vault-CRD Operator