|
| 1 | +# kubectl apply -f test/metrics.yml && kubectl scale --replicas=0 deploy/metrics && kubectl scale --replicas=1 deploy/metrics |
| 2 | +# kubectl exec metrics-... -- tail -f /tmp/loglast | egrep 'time_total|^jmx_scrape_duration_seconds|^java_lang_memory_heapmemoryusage_used|^java_lang_memory_nonheapmemoryusage_used' |
| 3 | +--- |
| 4 | +kind: ConfigMap |
| 5 | +metadata: |
| 6 | + name: metrics |
| 7 | + namespace: test-kafka |
| 8 | +apiVersion: v1 |
| 9 | +data: |
| 10 | + |
| 11 | + curl-format.txt: |- |
| 12 | + \n |
| 13 | + # ------ curl stats ------\n |
| 14 | + time_namelookup %{time_namelookup}\n |
| 15 | + time_connect %{time_connect}\n |
| 16 | + time_appconnect %{time_appconnect}\n |
| 17 | + time_pretransfer %{time_pretransfer}\n |
| 18 | + time_redirect %{time_redirect}\n |
| 19 | + time_starttransfer %{time_starttransfer}\n |
| 20 | + \n |
| 21 | + time_total{url="%{url_effective}"} %{time_total}\n |
| 22 | + \n |
| 23 | + http_code{url="%{url_effective}"} %{http_code}\n |
| 24 | + size_download{url="%{url_effective}"} %{size_download}\n |
| 25 | + content_type %{content_type}\n |
| 26 | + # ----- curl complete -----\n |
| 27 | + \n |
| 28 | +
|
| 29 | + setup.sh: |- |
| 30 | + touch /tmp/testlog |
| 31 | + tail -f /tmp/testlog |
| 32 | +
|
| 33 | + continue.sh: |- |
| 34 | + exit 0 |
| 35 | +
|
| 36 | + run.sh: |- |
| 37 | + exec >> /tmp/testlog |
| 38 | + exec 2>&1 |
| 39 | +
|
| 40 | + date -u -Iseconds | tee /tmp/loglast |
| 41 | +
|
| 42 | + curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \ |
| 43 | + http://kafka-0.broker.kafka.svc.cluster.local:5556/metrics \ |
| 44 | + | tee -a /tmp/loglast \ |
| 45 | + | grep http_code \ |
| 46 | + | grep 200 |
| 47 | +
|
| 48 | + curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \ |
| 49 | + http://zoo-0.zoo.kafka.svc.cluster.local:5556/metrics \ |
| 50 | + | tee -a /tmp/loglast \ |
| 51 | + | grep http_code \ |
| 52 | + | grep 200 |
| 53 | +
|
| 54 | + curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \ |
| 55 | + http://pzoo-0.pzoo.kafka.svc.cluster.local:5556/metrics \ |
| 56 | + | tee -a /tmp/loglast \ |
| 57 | + | grep http_code \ |
| 58 | + | grep 200 |
| 59 | +
|
| 60 | + exit 0 |
| 61 | +
|
| 62 | +--- |
| 63 | +apiVersion: apps/v1beta1 |
| 64 | +kind: Deployment |
| 65 | +metadata: |
| 66 | + name: metrics |
| 67 | + namespace: test-kafka |
| 68 | +spec: |
| 69 | + replicas: 1 |
| 70 | + template: |
| 71 | + metadata: |
| 72 | + labels: |
| 73 | + test-target: kafka |
| 74 | + test-type: readiness |
| 75 | + spec: |
| 76 | + containers: |
| 77 | + - name: testcase |
| 78 | + image: solsson/curl@sha256:8c0c5d669b3dd67932da934024252af59fb9d0fa0e5118b5a737b35c5e1487bf |
| 79 | + env: |
| 80 | + - name: MAX_RESPONSE_TIME |
| 81 | + value: "3" |
| 82 | + # Test set up |
| 83 | + command: |
| 84 | + - /bin/bash |
| 85 | + - -e |
| 86 | + - /test/setup.sh |
| 87 | + # Test run, again and again |
| 88 | + readinessProbe: |
| 89 | + exec: |
| 90 | + command: |
| 91 | + - /bin/bash |
| 92 | + - -e |
| 93 | + - /test/run.sh |
| 94 | + # Test quit on nonzero exit |
| 95 | + livenessProbe: |
| 96 | + exec: |
| 97 | + command: |
| 98 | + - /bin/bash |
| 99 | + - -e |
| 100 | + - /test/continue.sh |
| 101 | + volumeMounts: |
| 102 | + - name: config |
| 103 | + mountPath: /test |
| 104 | + volumes: |
| 105 | + - name: config |
| 106 | + configMap: |
| 107 | + name: metrics |
0 commit comments