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