-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_devstack_integration_tests.sh
executable file
·85 lines (66 loc) · 2.4 KB
/
run_devstack_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
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
#!/bin/bash
set -e
source /openedx/venv/bin/activate
ls
pwd
mkdir -p reports
pip install -r ./requirements/edx/testing.txt
pip install -r ./requirements/edx/paver.txt
# Installing edx-platform
pip install -e .
mkdir -p test_root # for edx
paver update_assets lms --settings=test_static_optimized
cp test_root/staticfiles/lms/webpack-stats.json test_root/staticfiles/webpack-stats.json
cd /open-edx-plugins
# Installing test dependencies
pip install pytest-mock==3.14.0
pip install responses==0.25.3
# Plugins that may affect the tests of other plugins.
# e.g. openedx-companion-auth adds a redirect to the authentication
# that fails the authentication process for other plugins.
isolated_plugins=("openedx-companion-auth")
# Install codecov so we can upload code coverage results
pip install codecov
# output the packages which are installed for logging
pip freeze
export EDXAPP_TEST_MONGO_HOST=mongodb
set +e
for subdir in "src"/*; do
if [ -d "$subdir" ]; then
tests_directory="$subdir/tests"
# Check if tests directory exists
if [ -d "$tests_directory" ]; then
# Installing the plugin
plugin_name=$(basename "$subdir" | sed 's/src\///' | sed 's/_/-/g')
tarball=$(ls dist | grep "$plugin_name" | head -n 1)
pip install "dist/$tarball"
cp -r /openedx/edx-platform/test_root/ "/open-edx-plugins/$subdir/test_root"
echo "==============Running $subdir tests=================="
cd "$subdir"
# Check for the existence of settings/test.py
if [ -f "settings/test.py" ]; then
pytest_command="pytest . --cov . --ds=settings.test"
else
pytest_command="pytest . --cov . --ds=lms.envs.test"
fi
# Run the pytest command
$pytest_command
PYTEST_SUCCESS=$?
if [[ $PYTEST_SUCCESS -ne 0 ]]
then
echo "pytest exited with a non-zero status"
exit $PYTEST_SUCCESS
fi
coverage xml
# Check if the plugin name is in the isolated_plugins list and uninstall it
for plugin in "${isolated_plugins[@]}"; do
if [[ "$plugin_name" == "$plugin" ]]; then
pip uninstall -y "$plugin_name"
break
fi
done
cd ../..
fi
fi
done
set -e