From 483f83692ec68db983606073046e9952c1ac8eec Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Mon, 24 Jun 2024 10:53:24 -0400 Subject: [PATCH 1/2] feat: set `EDXAPP_TEST_MONGO_HOST=mongodb` in openedx-dev --- changelog.d/20240624_105125_kyle_test_mongo_host.md | 1 + docs/tutorials/edx-platform.rst | 1 - tutor/templates/build/openedx/Dockerfile | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20240624_105125_kyle_test_mongo_host.md diff --git a/changelog.d/20240624_105125_kyle_test_mongo_host.md b/changelog.d/20240624_105125_kyle_test_mongo_host.md new file mode 100644 index 0000000000..7987cb4431 --- /dev/null +++ b/changelog.d/20240624_105125_kyle_test_mongo_host.md @@ -0,0 +1 @@ +[Improvement] Set `EDXAPP_TEST_MONGO_HOST` env var in the openedx-dev image so that it no longer needs to be set by hand when running edx-platform unit tests (by @kdmccormick). diff --git a/docs/tutorials/edx-platform.rst b/docs/tutorials/edx-platform.rst index 793498a248..ea687b9687 100644 --- a/docs/tutorials/edx-platform.rst +++ b/docs/tutorials/edx-platform.rst @@ -151,7 +151,6 @@ Then, run unit tests with ``pytest`` commands:: # Run tests on common apps unset DJANGO_SETTINGS_MODULE unset SERVICE_VARIANT - export EDXAPP_TEST_MONGO_HOST=mongodb pytest common pytest openedx pytest xmodule diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index c9c933266d..c0a2007f76 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -275,6 +275,9 @@ RUN pip install -e "/mnt/{{ name }}" # Add ipdb as default PYTHONBREAKPOINT ENV PYTHONBREAKPOINT=ipdb.set_trace +# Point unit tests at the MongoDB container +ENV EDXAPP_TEST_MONGO_HOST=mongodb + # Recompile static assets: in development mode all static assets are stored in edx-platform, # and the location of these files is stored in webpack-stats.json. If we don't recompile # static assets, then production assets will be served instead. From 9650d948f71deba52c63bb0a1925fedd74cbde06 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Tue, 20 Aug 2024 11:13:22 -0400 Subject: [PATCH 2/2] fix: use MONGODB_HOST, MONGODB_PORT from config --- tutor/templates/build/openedx/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index c0a2007f76..e275c3fe23 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -276,7 +276,8 @@ RUN pip install -e "/mnt/{{ name }}" ENV PYTHONBREAKPOINT=ipdb.set_trace # Point unit tests at the MongoDB container -ENV EDXAPP_TEST_MONGO_HOST=mongodb +ENV EDXAPP_TEST_MONGO_HOST={{ MONGODB_HOST }} +ENV EDXAPP_TEST_MONGO_PORT_NUM={{ MONGODB_PORT }} # Recompile static assets: in development mode all static assets are stored in edx-platform, # and the location of these files is stored in webpack-stats.json. If we don't recompile