diff options
Diffstat (limited to 'charts/llm-app/templates/smoketest-job.yaml')
| -rw-r--r-- | charts/llm-app/templates/smoketest-job.yaml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/charts/llm-app/templates/smoketest-job.yaml b/charts/llm-app/templates/smoketest-job.yaml new file mode 100644 index 0000000..ac97f33 --- /dev/null +++ b/charts/llm-app/templates/smoketest-job.yaml | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | apiVersion: batch/v1 | ||
| 2 | kind: Job | ||
| 3 | metadata: | ||
| 4 | name: {{ include "llm-app.fullname" . }}-smoketest | ||
| 5 | annotations: | ||
| 6 | "helm.sh/hook": post-install,post-upgrade | ||
| 7 | "helm.sh/hook-weight": "10" | ||
| 8 | "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
| 9 | spec: | ||
| 10 | backoffLimit: 2 | ||
| 11 | activeDeadlineSeconds: 240 | ||
| 12 | ttlSecondsAfterFinished: 600 | ||
| 13 | template: | ||
| 14 | spec: | ||
| 15 | restartPolicy: Never | ||
| 16 | containers: | ||
| 17 | - name: curl | ||
| 18 | image: curlimages/curl:8.10.1 | ||
| 19 | command: ["/bin/sh", "-euc"] | ||
| 20 | args: | ||
| 21 | - | | ||
| 22 | ENDPOINT="http://{{ include "llm-app.fullname" . }}:{{ .Values.service.port }}" | ||
| 23 | MODEL={{ .Values.model.alias | quote }} | ||
| 24 | echo "smoketest: GET $ENDPOINT/v1/models" | ||
| 25 | out=$(curl -fsS --max-time 60 "$ENDPOINT/v1/models") | ||
| 26 | echo "$out" | grep -q "\"$MODEL\"" || { echo "FAIL: $MODEL not listed in /v1/models"; echo "$out"; exit 1; } | ||
| 27 | echo "smoketest: POST $ENDPOINT/v1/chat/completions" | ||
| 28 | resp=$(curl -fsS --max-time 90 "$ENDPOINT/v1/chat/completions" \ | ||
| 29 | -H "Content-Type: application/json" \ | ||
| 30 | -d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with just: pong\"}],\"max_tokens\":8,\"temperature\":0}") | ||
| 31 | echo "$resp" | grep -q '"content"' || { echo "FAIL: no content in response"; echo "$resp"; exit 1; } | ||
| 32 | echo "OK" | ||
