forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration_tests.sh
executable file
·59 lines (46 loc) · 1.5 KB
/
integration_tests.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env nix-shell
#! nix-shell -i sh
export SOLR_VERSION=${SOLR_VERSION:-8.8.2}
run_tests() {
local stop="$1"
local output="$2"
echo -e "\n\rRunning integration tests..."
dotnet test SolrNet.Tests.Integration --filter 'Category=Integration' --logger html 1>$output 2>$output
ret=$?
if [ -n "$stop" ]; then
echo -e "\n\rStopping Solr..."
docker stop solr_cloud
fi
return $ret
}
create_solr() {
local next="$1"
echo -e "\n\rWaiting for Solr to start..."
until docker container inspect solr_cloud 1>/dev/null 2>/dev/null; do
sleep 0.5
done
until curl -s http://localhost:8983 1>/dev/null 2>/dev/null; do
sleep 0.5
done
echo -e "\n\rSetting up Solr collection and documents..."
docker exec solr_cloud solr create_collection -c techproducts -d sample_techproducts_configs 1>/dev/null 2>/dev/null
docker exec solr_cloud post -c techproducts 'example/exampledocs/' 1>/dev/null 2>/dev/null
curl -s -X POST -H 'Content-type:application/json' -d '{
"update-requesthandler": {
"name": "/select",
"class": "solr.SearchHandler",
"last-components": ["spellcheck"]
}
}' http://localhost:8983/solr/techproducts/config >/dev/null
echo -e "\n\rSolr available at http://localhost:8983\n\r"
set -x
$next
}
output=$(mktemp)
trap "rm $output" EXIT
create_solr "run_tests stop $output" &
# create_solr "true" &
tests=$!
docker run --rm -p 8983:8983 --name solr_cloud solr:$SOLR_VERSION solr start -cloud -f >solr_output.txt
cat $output
wait $tests