-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathtester.sh
executable file
·128 lines (110 loc) · 4 KB
/
tester.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# Tests python-arango driver against a local ArangoDB single server or cluster setup.
# 1. Starts a local ArangoDB server or cluster (community).
# 2. Runs the python-arango tests for the community edition.
# 3. Starts a local ArangoDB server or cluster (enterprise).
# 4. Runs all python-arango tests, including enterprise tests.
# Usage:
# ./tester.sh [all|single|cluster] [all|community|enterprise] [version] ["notest"]
setup="${1:-all}"
if [[ "$setup" != "all" && "$setup" != "single" && "$setup" != "cluster" ]]; then
echo "Invalid argument. Please provide either 'all', 'single' or 'cluster'."
exit 1
fi
tests="${2:-all}"
if [[ "$tests" != "all" && "$tests" != "community" && "$tests" != "enterprise" ]]; then
echo "Invalid argument. Please provide either 'all', 'community', or 'enterprise'."
exit 1
fi
# 3.11.2
# 3.10.9
# 3.9.11
version="${3:-3.11.1}"
if [[ -n "$4" && "$4" != "notest" ]]; then
echo "Invalid argument. Use 'notest' to only start the docker container, without running the tests."
exit 1
fi
mode="${4:-test}"
if [ "$setup" == "all" ] || [ "$setup" == "single" ]; then
if [ "$tests" == "all" ] || [ "$tests" == "community" ]; then
echo "Starting single server community setup..."
docker run -d --rm \
--name arango \
-p 8529:8529 \
-v "$(pwd)/tests/static/":/tests/static \
-v /tmp:/tmp \
arangodb/arangodb:"$version" \
/bin/sh -c "arangodb --configuration=/tests/static/single.conf"
if [[ "$mode" == "notest" ]]; then
exit 0
fi
echo "Running python-arango tests for single server community setup..."
sleep 3
py.test --complete --cov=arango --cov-report=html | tee single_community_results.txt
echo "Stopping single server community setup..."
docker stop arango
docker wait arango
sleep 3
fi
if [ "$tests" == "all" ] || [ "$tests" == "enterprise" ]; then
echo "Starting single server enterprise setup..."
docker run -d --rm \
--name arango \
-p 8529:8529 \
-v "$(pwd)/tests/static/":/tests/static \
-v /tmp:/tmp \
arangodb/enterprise:"$version" \
/bin/sh -c "arangodb --configuration=/tests/static/single.conf"
if [[ "$mode" == "notest" ]]; then
exit 0
fi
echo "Running python-arango tests for single server enterprise setup..."
sleep 3
py.test --complete --enterprise --cov=arango --cov-report=html --cov-append | tee single_enterprise_results.txt
echo "Stopping single server enterprise setup..."
docker stop arango
docker wait arango
sleep 3
fi
fi
if [ "$setup" == "all" ] || [ "$setup" == "cluster" ]; then
if [ "$tests" == "all" ] || [ "$tests" == "community" ]; then
echo "Starting community cluster setup..."
docker run -d --rm \
--name arango \
-p 8529:8529 \
-v "$(pwd)/tests/static/":/tests/static \
-v /tmp:/tmp \
arangodb/arangodb:"$version" \
/bin/sh -c "arangodb --configuration=/tests/static/cluster.conf"
if [[ "$mode" == "notest" ]]; then
exit 0
fi
echo "Running python-arango tests for community cluster setup..."
sleep 15
py.test --cluster --complete --cov=arango --cov-report=html | tee cluster_community_results.txt
echo "Stopping community cluster setup..."
docker stop arango
docker wait arango
sleep 3
fi
if [ "$tests" == "all" ] || [ "$tests" == "enterprise" ]; then
echo "Starting enterprise cluster setup..."
docker run -d --rm \
--name arango \
-p 8529:8529 \
-v "$(pwd)/tests/static/":/tests/static \
-v /tmp:/tmp \
arangodb/enterprise:"$version" \
/bin/sh -c "arangodb --configuration=/tests/static/cluster.conf"
if [[ "$mode" == "notest" ]]; then
exit 0
fi
echo "Running python-arango tests for enterprise cluster setup..."
sleep 15
py.test --cluster --enterprise --complete --cov=arango --cov-report=html | tee cluster_enterprise_results.txt
echo "Stopping enterprise cluster setup..."
docker stop arango
docker wait arango
fi
fi