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

Important Upgrade Announcement of Mirror World Network

6 Things You Must Know Before Changing Developers

Hello from Belgium ! ‘WHY’ is it this way ?

JS — Week 6 Interview Questions

My 90 day journey becoming a Unity game developer: Day-12

Deploying to a cloud with AWS CloudFormation

One does not simply limit WIP…

Genetic Algorithm-Everything You Need To Know

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

Managing Disconnected Signatures Using cosign

Magalix + Weaveworks: Forging the Path of Secure GitOps Workflows

No! You shall not pass! Kyverno’s here!

Intro to Kubernetes Mutating Webhooks (get more out of Kubernetes)