Skip to content

Commit 85ce4ba

Browse files
Merge pull request #42 from peterparser/master
Add new feature to README and bump Dockerfile
2 parents 457549d + 54faebd commit 85ce4ba

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
FROM alpine:3.14
22

3-
ARG KUBECTL_VERSION=v1.21.2
4-
ARG HELM_VERSION=v3.6.1
5-
ARG BATS_VERSION=1.3.0
3+
ARG KUBECTL_VERSION=v1.29.2
4+
ARG HELM_VERSION=v3.14.2
5+
ARG BATS_VERSION=1.10.0
66

77
# Add packages
88
RUN apk --no-cache add \

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ DETIK_CLIENT_NAMESPACE="my-specific-namespace"
148148
# Verify the number of PODS and services
149149
verify "there are 2 pods named 'nginx'"
150150
verify "there is 1 service named 'nginx'"
151+
verify "there are less than 3 pods named 'nginx'"
152+
verify "there are more than 1 pods named 'nginx'"
151153

152154
# Verify assertions on resources
153155
verify "'status' is 'running' for pods named 'nginx'"
@@ -157,6 +159,8 @@ verify "'.spec.ports[*].targetPort' is '8484' for services named 'nginx'"
157159
# You can also specify a number of attempts
158160
try "at most 5 times every 30s to get pods named 'nginx' and verify that 'status' is 'running'"
159161
try "at most 5 times every 30s to get svc named 'nginx' and verify that '.spec.ports[*].targetPort' is '8484'"
162+
try "at most 5 times every 30s to get deployment named 'nginx' and verify that 'status.currentReplicas' is more than '2'"
163+
try "at most 5 times every 30s to get deployment named 'nginx' and verify that 'status.currentReplicas' is less than '4'"
160164

161165
# Long assertions can also be split over several lines
162166
try "at most 5 times every 30s " \
@@ -283,8 +287,14 @@ Verify there are N resources of this type with this name pattern.
283287
# Expecting 0 or 1 instance
284288
verify "there is <0 or 1> <resource-type> named '<regular-expression>'"
285289

286-
# Expecting more than 1 instance
290+
# Expecting <number> instances
287291
verify "there are <number> <resource-type> named '<regular-expression>'"
292+
293+
# Expecting more than <number> instances
294+
verify "there are more than <number> <resource-type> named '<regular-expression>'"
295+
296+
# Expecting less than <number> instances
297+
verify "there are less than <number> <resource-type> named '<regular-expression>'"
288298
```
289299

290300
*resource-type* is one of the K8s ones (e.g. `pods`, `po`, `services`, `svc`...).

examples/bats/test_kubectl_and_oc.sh

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ DETIK_CLIENT_NAME="kubectl"
1717
# Basic examples
1818
verify "there are 1 service named 'nginx'"
1919
verify "there are 4 pods named 'nginx'"
20+
verify "there are more than 2 pods named 'nginx'"
21+
verify "there are less than 5 pods named 'nginx'"
2022

2123
# The same thing (it is case insensitive)
2224
verify "There are 4 pods naMed 'nginx'"
@@ -62,6 +64,10 @@ try "at most 5 times every 5s to get pods named 'nginx' and verify that 'status'
6264
# The same thing (it is case insensitive)
6365
try "at most 5 times every 15s to GET pods named 'nginx' and verify that 'status' is 'RUNNING'"
6466

67+
# Basic examples with more/less than
68+
try "at most 5 times every 5s to get deploy named 'nginx' and verify that 'status.currentReplicas' is more than '1'"
69+
try "at most 5 times every 5s to get deploy named 'nginx' and verify that 'status.currentReplicas' is less than '3'"
70+
6571
# Use short names for resources ('po' instead of 'pods')
6672
# See https://kubernetes.io/docs/reference/kubectl/overview/#resource-types
6773
try "at most 5 times every 5s to get po named 'nginx' and verify that 'status' is 'running'"

0 commit comments

Comments
 (0)