forked from openedx-unsupported/edx-analytics-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunTests.sh
More file actions
executable file
·56 lines (44 loc) · 1.52 KB
/
runTests.sh
File metadata and controls
executable file
·56 lines (44 loc) · 1.52 KB
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
#!/usr/bin/env bash
TEST_DIR=${1?arg missing, specify a directory to find tests}
# this stops the django servers
stopServers() {
kill $(ps aux | grep "[m]anage.py" | awk '{print $2}')
}
echo "Stop any already running servers..."
stopServers
echo "Setting test related environment variables..."
export API_SERVER_URL=http://127.0.0.1:9001/api/v0
export API_AUTH_TOKEN=edx
export LMS_HOSTNAME=lms
export LMS_PASSWORD=pass
export LMS_USERNAME=user
export ENABLE_AUTO_AUTH=True
export ENABLE_OAUTH_TESTS=False
export ENABLE_ERROR_PAGE_TESTS=False
echo "Migrating Analytics Dashboard DB..."
make migrate
echo "Preparing Analytics Data API..."
cd edx-analytics-data-api/
make travis
cd -
mkdir -p logs
echo "Starting Analytics Data API Server..."
./edx-analytics-data-api/manage.py runserver 9001 --noreload > logs/api.log 2>&1 &
echo "Starting Analytics Dashboard Server..."
./manage.py runserver 9000 --noreload --traceback > logs/dashboard.log 2>&1 &
echo "Running $TEST_DIR tests..."
nosetests -v $TEST_DIR -e NUM_PROCESSES=1 --exclude-dir=acceptance_tests/course_validation
# capture the exit code from the test. Anything more than 0 indicates failed cases.
EXIT_CODE=$?
echo "Shutting down server..."
stopServers
if [[ "$EXIT_CODE" = "0" ]]; then
echo "All tests passed..."
else
echo "Failed tests..."
echo -e "\033[33;34m Server Logs for Analytics Data API Server... \033[0m "
cat logs/api.log
echo -e "\033[33;34m Server logs for Analytics Dashboard Server... \033[0m "
cat logs/dashboard.log
fi
exit $EXIT_CODE