Skip to content

Commit 1de4d2c

Browse files
committed
An actual assertion
1 parent 071f973 commit 1de4d2c

File tree

1 file changed

+72
-10
lines changed

1 file changed

+72
-10
lines changed

events-kube/test/events-topic.yml

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,89 @@
1+
---
2+
kind: ConfigMap
3+
metadata:
4+
name: events-topic
5+
namespace: test-kafka
6+
apiVersion: v1
7+
data:
8+
9+
setup.sh: |-
10+
touch /tmp/testlog
11+
12+
tail -f /tmp/testlog
13+
14+
test.sh: |-
15+
exec >> /tmp/testlog
16+
exec 2>&1
17+
18+
PREVIOUS=$(sha1sum /tmp/event || echo "")
19+
kafkacat -b $BOOTSTRAP -t $TOPIC -C -o -1 -c 1 | tee /tmp/event
20+
CURRENT=$(sha1sum /tmp/event)
21+
[ "$PREVIOUS" == "$CURRENT" ] && echo "{\"test-status\”: \"No new event in $TOPIC\"}" && exit 1
22+
23+
exit 0
24+
25+
quit-on-nonzero-exit.sh: |-
26+
exec >> /tmp/testlog
27+
exec 2>&1
28+
29+
exit 0
30+
31+
---
132
apiVersion: apps/v1beta2
233
kind: Deployment
334
metadata:
435
name: events-topic
536
namespace: test-kafka
637
spec:
738
replicas: 1
39+
strategy:
40+
type: Recreate
841
selector:
942
matchLabels:
1043
test-target: events-topic
44+
test-type: readiness
1145
template:
1246
metadata:
1347
labels:
1448
test-target: events-topic
15-
# Would be a valid testcase if it verifies that >0 messages per some time unit have been produced
16-
#test-type: readiness
49+
test-type: readiness
50+
# for example:
51+
# readonly - can be used in production
52+
# isolated - read/write but in a manner that does not affect other services
53+
# load - unsuitable for production because it uses significant resources
54+
# chaos - unsuitable for production because it injects failure modes
55+
#test-use:
1756
spec:
1857
containers:
19-
- name: kafkacat
20-
image: solsson/kafkacat@sha256:36d1f191cc33a8365074280279205e6b4f52cd8cc8fb1b896bb4c943c9dee8f8
58+
- name: testcase
59+
image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef
60+
env:
61+
- name: BOOTSTRAP
62+
value: kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092
63+
- name: TOPIC
64+
value: ops-kube-events-all-json-001
2165
command:
22-
- kafkacat
23-
- -b
24-
- kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092
25-
- -t
26-
- ops-kube-events-all-json-001
27-
- -C
66+
- /bin/bash
67+
- -e
68+
- /test/setup.sh
69+
readinessProbe:
70+
exec:
71+
command:
72+
- /bin/bash
73+
- -e
74+
- /test/test.sh
75+
initialDelaySeconds: 10
76+
periodSeconds: 10
77+
livenessProbe:
78+
exec:
79+
command:
80+
- /bin/bash
81+
- -e
82+
- /test/quit-on-nonzero-exit.sh
83+
volumeMounts:
84+
- name: config
85+
mountPath: /test
86+
volumes:
87+
- name: config
88+
configMap:
89+
name: events-topic

0 commit comments

Comments
 (0)