-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛(tests) configure DRF in lms settings & use lms settings in tests #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,11 @@ ENV DOCKERIZE_VERSION v0.6.0 | |
ARG user=0 | ||
ARG group=0 | ||
|
||
# Add a non-privileged user to run the application | ||
RUN groupadd --gid $group app && \ | ||
useradd --uid $user --gid $group --home /app --create-home app | ||
# Add a non-privileged user to run the application if given as a build argument | ||
RUN if [ ${user} -ne 0 -a ${group} -ne 0 ]; then \ | ||
groupadd --gid $group app ; \ | ||
useradd --uid $user --gid $group --home /app app ; \ | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use redhat pattern as we don't want to create images that work only with one user? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't mind I would prefer to handle this in a new PR as it requires substantial changes. I'll declare a new issue for this. Deal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FTR #11 |
||
|
||
# Install dockerize | ||
RUN curl -L \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,6 @@ function install_dependencies() { | |
echo "Building fonzie containers..." | ||
|
||
_dc_build lms | ||
_dc_build fonzie | ||
FONZIE_UNSET_USER=1 _dc_run --no-deps node yarn install --no-progress | ||
} | ||
|
||
|
@@ -59,49 +58,49 @@ function install_dependencies() { | |
function run_test_suite() { | ||
echo "Starting the test suite..." | ||
|
||
if [ -z $TOXENV ]; then | ||
echo "Running API spec test suite..." | ||
_docker_compose --no-ansi up -d lms | ||
|
||
_docker_compose --no-ansi up -d lms | ||
# Wait for mysql database to accept connections | ||
_dc_run fonzie dockerize -wait tcp://mysql:3306 -timeout 60s | ||
|
||
# Wait for mysql database to accept connections | ||
_dc_run fonzie dockerize -wait tcp://mysql:3306 -timeout 60s | ||
local sql="$HOME/.cache/db/$OPENEDX_RELEASE.sql" | ||
local database="edxapp" | ||
|
||
local sql="$HOME/.cache/db/$OPENEDX_RELEASE.sql" | ||
local database="edxapp" | ||
if [ -e $sql ]; then | ||
echo "Stack status:" | ||
_docker_compose ps | ||
|
||
if [ -e $sql ]; then | ||
echo "Stack status:" | ||
_docker_compose ps | ||
echo "MySQL container logs:" | ||
_docker_compose logs mysql | ||
|
||
echo "MySQL container logs:" | ||
_docker_compose logs mysql | ||
echo "MySQL container ID:" | ||
_docker_compose ps -q mysql | ||
|
||
echo "MySQL container ID:" | ||
_docker_compose ps -q mysql | ||
|
||
echo "Loading database schema from cache: $sql" | ||
# FIXME: docker-compose is having issues with huge files streamed | ||
# via a pty/stdin, so we bypass compose to use raw docker exec | ||
# command. | ||
docker exec -i $(_docker_compose ps -q mysql) mysql -u root $database < $sql | ||
else | ||
# Perform database migrations | ||
echo "Starting database migration" | ||
_dc_run lms python ./manage.py lms migrate | ||
|
||
# Dump database | ||
echo "Dump database schema to: $sql" | ||
_dc_exec mysql mysqldump -u root $database > $sql | ||
fi | ||
|
||
# Run API implementation tests | ||
_dc_run node yarn dredd | ||
echo "Loading database schema from cache: $sql" | ||
# FIXME: docker-compose is having issues with huge files streamed | ||
# via a pty/stdin, so we bypass compose to use raw docker exec | ||
# command. | ||
docker exec -i $(_docker_compose ps -q mysql) mysql -u root $database < $sql | ||
else | ||
echo "Running tox:$TOXENV test suite..." | ||
# Perform database migrations | ||
echo "Starting database migration" | ||
_dc_run lms python ./manage.py lms migrate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cms migrations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fonzie is installed in the LMS application. Is the LMS standalone, or does it requires the CMS to run? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok so maybe remove it from elsewhere? |
||
|
||
_dc_run -e TOXENV fonzie tox | ||
# Dump database | ||
echo "Dump database schema to: $sql" | ||
_dc_exec mysql mysqldump -u root $database > $sql | ||
fi | ||
|
||
case "$CI_STEP" in | ||
quality|docs|test) | ||
make ${CI_STEP} | ||
;; | ||
test-spec) | ||
echo "Running API spec test suite..." | ||
_dc_run node yarn dredd | ||
;; | ||
*) | ||
esac | ||
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you were removing Travis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will. Not in this PR. I'll declare another issue for this. Deal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR #10