@@ -14,8 +14,14 @@ rm /tmp/response1.log /tmp/response2.log /tmp/nitro.log
1414BINARY_PATH=$1
1515DOWNLOAD_URL=$2
1616
17+ # Random port to ensure it's not used
18+ min=10000
19+ max=11000
20+ range=$(( max - min + 1 ))
21+ PORT=$(( RANDOM % range + min))
22+
1723# Start the binary file
18- " $BINARY_PATH " 1 127.0.0.1 5000 > /tmp/nitro.log 2>&1 &
24+ " $BINARY_PATH " 1 127.0.0.1 $PORT > /tmp/nitro.log 2>&1 &
1925
2026# Get the process id of the binary file
2127pid=$!
2935# Wait for a few seconds to let the server start
3036sleep 5
3137
32-
33-
3438# Check if /tmp/testmodel exists, if not, download it
3539if [[ ! -f " /tmp/testmodel" ]]; then
3640 wget $DOWNLOAD_URL -O /tmp/testmodel
3741fi
3842
3943# Run the curl commands
40- response1=$( curl -o /tmp/response1.log -s -w " %{http_code}" --location ' http://127.0.0.1:5000 /inferences/llamacpp/loadModel' \
44+ response1=$( curl -o /tmp/response1.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/llamacpp/loadModel" \
4145--header ' Content-Type: application/json' \
4246--data ' {
4347 "llama_model_path": "/tmp/testmodel",
@@ -46,7 +50,7 @@ response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location 'http://1
4650 "embedding": false
4751}' 2>&1 )
4852
49- response2=$( curl -o /tmp/response2.log -s -w " %{http_code}" --location ' http://127.0.0.1:5000 /inferences/llamacpp/chat_completion' \
53+ response2=$( curl -o /tmp/response2.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/llamacpp/chat_completion" \
5054--header ' Content-Type: application/json' \
5155--header ' Accept: text/event-stream' \
5256--header ' Access-Control-Allow-Origin: *' \
0 commit comments