Open AmitKumarDas opened 4 years ago
UseCase 1: To further our expectation of declarative assertion, let us try to assert any Deployment that has one of its containers with a nginx image with name my-nginx. Solution: The assertion yaml should look like below:
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: my-nginx
image: nginx
UseCase 2: Assert any Deployment that has nginx image with container port 80 Solution: The assertion yaml should look like following:
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- image: nginx
ports:
- containerPort: 80
UseCase 3: Assert 3 Pods with label app:run in Running state Solution: The assertion yaml should look like following:
kind: PodList
count: 3
items:
- kind: Pod
metadata:
labels:
app: run
status:
phase: Running
UseCase 4: Assert 2 Pods with label app:run & app:running in Running state Solution: The assertion yaml should look like following:
kind: PodList
items:
- kind: Pod
metadata:
labels:
app: run
status:
phase: Running
- kind: Pod
metadata:
labels:
app: running
status:
phase: Running
As a developer I want to use better assertion logic than the following:
It will be great to assert list of values in a declarative manner.
For example below yaml should be enough to assert any Pods with the given label to be in Running state. It should return error if there are any Pods that are not Running.