Skip to content

Commit

Permalink
test: Integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tazarov committed Sep 21, 2024
1 parent 8edc76a commit 83b369e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ jobs:
# needs: build-images
strategy:
matrix:
kubernetes-version: [1.23.0, 1.24.0, 1.27.3, v1.28.0-rc.0]
kubernetes-version: [1.23.0, 1.30.0]
chroma-version:
[
0.4.9,
0.4.10, #pre-flight checks introduced
0.4.24,
0.5.5,
0.5.7,
]
runs-on: ubuntu-latest
steps:
Expand All @@ -114,7 +113,8 @@ jobs:
run: |
set -e
sleep 20
helm install chromadb ./charts/chromadb-chart --set chromadb.isPersistent=true \
helm install chromadb ./charts/chromadb-chart \
--set chromadb.isPersistent=true \
--set chromadb.allowReset=true \
--set chromadb.apiVersion=${{ matrix.chroma-version }}
- name: Wait for deployment to be ready
Expand All @@ -123,9 +123,9 @@ jobs:
--for=condition=ready pod \
--selector=app.kubernetes.io/name=chromadb \
--timeout=120s
- name: Hearthbeat
- name: Test
run: |
set -e
kubectl get pods -A
kubectl get svc -A
curl $(minikube service chromadb --url)/api/v1
helm test chromadb
40 changes: 40 additions & 0 deletions charts/chromadb-chart/templates/tests/test-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ include "chart.fullname" . }}-test-api"
labels:
{{- include "chart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": hook-succeeded
spec:
ttlSecondsAfterFinished: 100
template:
spec:
restartPolicy: Never
containers:
- name: curl
image: curlimages/curl:latest
command: ['curl']
args:
- '-v'
- 'http://{{ include "chart.fullname" . }}:{{ .Values.chromadb.serverHttpPort }}/api/v1/collections'
{{- if eq .Values.chromadb.auth.type "token" }}
{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Release.Namespace (include "chart.fullname" . | printf "%s-token-auth-config")) }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (.Values.chromadb.auth.existingSecret | default "chromadb-auth")) }} # TODO support existing secret
{{- if $existingSecret }}
- '-H'
{{- if eq $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER "Authorization" }} # Authorization: Bearer
- '{{ $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER }}: Bearer {{ $existingSecret.data.token | b64dec }}1'
{{- else }} # X-Chroma-Token
- '{{ $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER }}: {{ $existingSecret.data.token | b64dec }}'
{{- end }}
{{- end }}
{{- else if eq .Values.chromadb.auth.type "basic" }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (.Values.chromadb.auth.existingSecret | default "chromadb-auth")) }} # TODO support existing secret
{{- if $existingSecret }}
- '--user'
- "{{ $existingSecret.data.username }}:{{ $existingSecret.data.password }}"
{{- end }}
{{- end }}

41 changes: 33 additions & 8 deletions charts/chromadb-chart/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
apiVersion: v1
kind: Pod
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ include "chart.fullname" . }}-test-connection"
labels:
{{- include "chart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": hook-succeeded
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "chart.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
ttlSecondsAfterFinished: 100
template:
spec:
restartPolicy: Never
containers:
- name: curl
image: curlimages/curl:latest
command: ['curl']
args:
- '-v'
- 'http://{{ include "chart.fullname" . }}:{{ .Values.chromadb.serverHttpPort }}/api/v1/hearbeat'
{{- if eq .Values.chromadb.auth.type "token" }}
{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Release.Namespace (include "chart.fullname" . | printf "%s-token-auth-config")) }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (.Values.chromadb.auth.existingSecret | default "chromadb-auth")) }} # TODO support existing secret
{{- if $existingSecret }}
- '-H'
{{- if eq $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER "Authorization" }} # Authorization: Bearer
- '{{ $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER }}: Bearer {{ $existingSecret.data.token | b64dec }}1'
{{- else }} # X-Chroma-Token
- '{{ $existingConfigMap.data.CHROMA_AUTH_TOKEN_TRANSPORT_HEADER }}: {{ $existingSecret.data.token | b64dec }}'
{{- end }}
{{- end }}
{{- else if eq .Values.chromadb.auth.type "basic" }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace (.Values.chromadb.auth.existingSecret | default "chromadb-auth")) }} # TODO support existing secret
{{- if $existingSecret }}
- '--user'
- "{{ $existingSecret.data.username }}:{{ $existingSecret.data.password }}"
{{- end }}
{{- end }}

0 comments on commit 83b369e

Please sign in to comment.