-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
390 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM %%IMAGE_NAME%% | ||
|
||
ADD docker_test.sh /docker_test.sh | ||
|
||
# Test environment variables | ||
ENV TEST_VERSION=${TEST_VERSION} | ||
|
||
RUN set -ex; \ | ||
sudo chmod 755 /docker_test.sh; \ | ||
sudo pip install python-coveralls | ||
|
||
EXPOSE 4444 | ||
|
||
# Default Chrome configuration | ||
ENV DISPLAY=:20.0 \ | ||
SCREEN_GEOMETRY="1440x900x24" \ | ||
CHROMEDRIVER_PORT=4444 \ | ||
CHROMEDRIVER_WHITELISTED_IPS="127.0.0.1" \ | ||
CHROMEDRIVER_URL_BASE='' \ | ||
CHROMEDRIVER_EXTRA_ARGS='' | ||
|
||
CMD ["/docker_test.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/usr/bin/sh | ||
|
||
set -e | ||
|
||
################################################################################ | ||
# Testing docker containers | ||
|
||
echo "Waiting to ensure everything is fully ready for the tests..." | ||
sleep 60 | ||
|
||
echo "Checking content of sites directory..." | ||
if [ ! -f "./sites/apps.txt" ] || [ ! -f "./sites/.docker-app-init" ] || [ ! -f "./sites/currentsite.txt" ] || [ ! -f "./sites/.docker-site-init" ] || [ ! -f "./sites/.docker-init" ]; then | ||
echo 'Apps and site are not initalized?!' | ||
ls -al "./sites" | ||
exit 1 | ||
fi | ||
|
||
echo "Checking main containers are reachable..." | ||
if ! sudo ping -c 10 -q erpnext_db ; then | ||
echo 'Database container is not responding!' | ||
echo 'Check the following logs for details:' | ||
tail -n 100 logs/*.log | ||
exit 2 | ||
fi | ||
|
||
if ! sudo ping -c 10 -q erpnext_app ; then | ||
echo 'App container is not responding!' | ||
echo 'Check the following logs for details:' | ||
tail -n 100 logs/*.log | ||
exit 4 | ||
fi | ||
|
||
if ! sudo ping -c 10 -q erpnext_web ; then | ||
echo 'Web container is not responding!' | ||
echo 'Check the following logs for details:' | ||
tail -n 100 logs/*.log | ||
exit 8 | ||
fi | ||
|
||
|
||
################################################################################ | ||
# Success | ||
echo 'Docker tests successful' | ||
|
||
|
||
################################################################################ | ||
# Automated Unit tests | ||
# https://docs.docker.com/docker-hub/builds/automated-testing/ | ||
# https://frappe.io/docs/user/en/testing | ||
################################################################################ | ||
|
||
FRAPPE_APP_TO_TEST=erpnext_ocr | ||
|
||
echo "Preparing Frappe application '${FRAPPE_APP_TO_TEST}' tests..." | ||
|
||
################################################################################ | ||
# Frappe Unit tests | ||
# https://frappe.io/docs/user/en/guides/automated-testing/unit-testing | ||
|
||
FRAPPE_APP_UNIT_TEST_REPORT="$(pwd)/sites/.${FRAPPE_APP_TO_TEST}_unit_tests.xml" | ||
|
||
#bench run-tests --help | ||
|
||
echo "Executing Unit Tests of '${FRAPPE_APP_TO_TEST}' app..." | ||
if [ "${TEST_VERSION}" = "10" ]; then | ||
bench run-tests \ | ||
--app ${FRAPPE_APP_TO_TEST} \ | ||
--junit-xml-output "${FRAPPE_APP_UNIT_TEST_REPORT}" | ||
else | ||
bench run-tests \ | ||
--app ${FRAPPE_APP_TO_TEST} \ | ||
--coverage | ||
# FIXME https://github.com/frappe/frappe/issues/8809 | ||
# --junit-xml-output "${FRAPPE_APP_UNIT_TEST_REPORT}" | ||
fi | ||
|
||
## Check result of tests | ||
if [ -f "${FRAPPE_APP_UNIT_TEST_REPORT}" ]; then | ||
echo "Checking Frappe application '${FRAPPE_APP_TO_TEST}' unit tests report..." | ||
|
||
if grep 'FAILED' "${FRAPPE_APP_UNIT_TEST_REPORT}"; then | ||
echo "Unit Tests of '${FRAPPE_APP_TO_TEST}' app failed! See report for details:" | ||
cat "${FRAPPE_APP_UNIT_TEST_REPORT}" | ||
exit 1 | ||
else | ||
echo "Unit Tests of '${FRAPPE_APP_TO_TEST}' app successful! See report for details:" | ||
cat "${FRAPPE_APP_UNIT_TEST_REPORT}" | ||
fi | ||
fi | ||
|
||
if [ -f ./sites/.coverage ]; then | ||
echo "Sending Unit Tests coverage of '${FRAPPE_APP_TO_TEST}' app to Coveralls..." | ||
coveralls -b apps/${FRAPPE_APP_TO_TEST} -d ./sites/.coverage | ||
fi | ||
|
||
|
||
################################################################################ | ||
# TODO QUnit (JS) Unit tests | ||
# https://frappe.io/docs/user/en/guides/automated-testing/qunit-testing | ||
|
||
#bench run-ui-tests --help | ||
|
||
#echo "Executing UI Tests of '${FRAPPE_APP_TO_TEST}' app..." | ||
#if [ "${TEST_VERSION}" = "10" ] || [ "${TEST_VERSION}" = "11" ]; then | ||
# bench run-ui-tests --app ${FRAPPE_APP_TO_TEST} | ||
#else | ||
# bench run-ui-tests ${FRAPPE_APP_TO_TEST} | ||
#fi | ||
|
||
## TODO Check result of UI tests | ||
|
||
|
||
################################################################################ | ||
# Success | ||
echo 'Frappe app '${FRAPPE_APP_TO_TEST}' tests finished' | ||
echo 'Check the CI reports and logs for details.' | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.