-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcb6994
commit f94b01d
Showing
14 changed files
with
293 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.env | ||
*.npz | ||
index.faiss | ||
test* | ||
# test* | ||
# *.ipynb | ||
NOTE.md | ||
elastic_search_data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Any | ||
|
||
from locust import FastHttpUser, task | ||
|
||
|
||
class SearchImageUser(FastHttpUser): | ||
host = "http://search.vectornguyen.com/backend" | ||
|
||
def __init__(self, *args: Any, **kwargs: Any): | ||
super().__init__(*args, **kwargs) | ||
|
||
@task | ||
def healthz(self): | ||
self.client.get("/healthz") | ||
|
||
@task | ||
def create_user(self): | ||
data = { | ||
"email": "phuoc@gmail.com", | ||
"username": "Vector Nguyen", | ||
"image": "", | ||
"token": "", | ||
} | ||
|
||
self.client.post("/auth/users/tokens", json=data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "backend.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "backend.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "backend.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "frontend.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "frontend.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "frontend.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |
15 changes: 15 additions & 0 deletions
15
helm-charts/image-search/templates/tests/test-connection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "image-search.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "image-search.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "image-search.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |
98 changes: 98 additions & 0 deletions
98
helm-charts/qdrant/templates/tests/test-db-interaction.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{{- $root := . }} | ||
{{- $namespace := .Release.Namespace }} | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "qdrant.fullname" . }}-test-db-interaction" | ||
labels: | ||
{{- include "qdrant.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: test-script | ||
image: registry.suse.com/bci/bci-base:latest | ||
args: ['bash', '/app/entrypoint.sh'] | ||
volumeMounts: | ||
- mountPath: /app | ||
name: test-script | ||
{{- if .Values.additionalVolumeMounts }} | ||
{{- toYaml .Values.additionalVolumeMounts | default "" | nindent 8 }} | ||
{{- end}} | ||
volumes: | ||
- name: test-script | ||
configMap: | ||
name: "{{ include "qdrant.fullname" . }}-test-db-interaction" | ||
{{- if .Values.additionalVolumes }} | ||
{{- toYaml .Values.additionalVolumes | default "" | nindent 4 }} | ||
{{- end}} | ||
restartPolicy: Never | ||
serviceAccountName: {{ include "qdrant.fullname" . }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: "{{ include "qdrant.fullname" . }}-test-db-interaction" | ||
labels: | ||
{{- include "qdrant.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
data: | ||
entrypoint.sh: | | ||
#!/bin/bash | ||
set -xe | ||
echo 'connect-timeout = 5' > $HOME/.curlrc | ||
echo 'retry = 5' >> $HOME/.curlrc | ||
echo 'retry-all-errors' >> $HOME/.curlrc | ||
if [ -d /mnt/secrets/certs ]; then | ||
cp /mnt/secrets/certs/ca.pem /usr/share/pki/trust/anchors/private-ca.pem | ||
update-ca-certificates | ||
fi | ||
QDRANT_COLLECTION="test_collection" | ||
{{- range .Values.service.ports }} | ||
{{- if eq .name "http" }} | ||
echo "Connecting to {{ include "qdrant.fullname" $root }}.{{ $namespace }}:{{ .port }}" | ||
QDRANT_URL="http://{{ include "qdrant.fullname" $root }}.{{ $namespace }}:{{ .port }}" | ||
{{- if and $root.Values.config.service $root.Values.config.service.enable_tls }} | ||
echo "Using https" | ||
QDRANT_URL="https://{{ include "qdrant.fullname" $root }}.{{ $namespace }}:{{ .port }}" | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
API_KEY_HEADER="" | ||
{{- if .Values.apiKey }} | ||
API_KEY_HEADER="Api-key: {{ .Values.apiKey }}" | ||
{{- end }} | ||
# Delete collection if exists | ||
curl -X DELETE -H "${API_KEY_HEADER}" $QDRANT_URL/collections/${QDRANT_COLLECTION} | ||
# Create collection | ||
curl -X PUT \ | ||
-H 'Content-Type: application-json' \ | ||
-d '{"vectors":{"size":4,"distance":"Dot"}}' \ | ||
-H "${API_KEY_HEADER}" \ | ||
$QDRANT_URL/collections/${QDRANT_COLLECTION} --fail-with-body | ||
# Insert points | ||
curl -X PUT \ | ||
-H 'Content-Type: application-json' \ | ||
-d '{"points":[ | ||
{"id":1,"vector":[0.05, 0.61, 0.76, 0.74],"payload":{"city":"Berlin"}}, | ||
{"id":2,"vector":[0.19, 0.81, 0.75, 0.11],"payload":{"city":"London"}}, | ||
{"id":3,"vector":[0.36, 0.55, 0.47, 0.94],"payload":{"city":"Moscow"}}, | ||
{"id":4,"vector":[0.18, 0.01, 0.85, 0.80],"payload":{"city":"New York"}}, | ||
{"id":5,"vector":[0.24, 0.18, 0.22, 0.44],"payload":{"city":"Beijing"}}, | ||
{"id":6,"vector":[0.35, 0.08, 0.11, 0.44],"payload":{"city":"Mumbai"}} | ||
]}' \ | ||
-H "${API_KEY_HEADER}" \ | ||
$QDRANT_URL/collections/${QDRANT_COLLECTION}/points --fail-with-body | ||
# Run query | ||
curl -X POST \ | ||
-H 'Content-Type: application-json' \ | ||
-d '{"vector":[0.2, 0.1, 0.9, 0.7],"limit":3}' \ | ||
-H "${API_KEY_HEADER}" \ | ||
$QDRANT_URL/collections/${QDRANT_COLLECTION}/points/search --fail-with-body |
15 changes: 15 additions & 0 deletions
15
helm-charts/text-search/templates/tests/test-connection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "text-search.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "text-search.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "text-search.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |