File size: 954 Bytes
3932407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# This runs the auth integration tests in isolation

set -eux
set -o pipefail

# Ensure current path is project root
cd "$(dirname "$0")/../"

export QDRANT__SERVICE__HOST="0.0.0.0"
export QDRANT__SERVICE__API_KEY="my-secret"
export QDRANT__SERVICE__READ_ONLY_API_KEY="my-ro-secret"

./target/debug/qdrant &

#Capture PID of the process
PID=$!

function clear_after_tests()
{
    echo "server is going down"
    kill -9 $PID
    echo "END"
}

trap clear_after_tests EXIT

QDRANT_HOST='localhost'
until curl --output /dev/null --silent --get --fail -H 'api-key: my-ro-secret' http://$QDRANT_HOST:6333/collections; do
    printf 'waiting for server to start...'
    sleep 5
done

echo "server ready to serve traffic"

IMAGE_NAME=$(docker buildx build --load -q "tests/api_key")
docker run --rm \
       -e QDRANT_HOST=host.docker.internal \
       --add-host host.docker.internal:host-gateway \
       $IMAGE_NAME sh -c "pytest /tests"