Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Run TestSafeOrNot:test_cant_do_something_forbidden in Tutor #156

Closed
Tracked by #155
kdmccormick opened this issue Jan 9, 2023 · 5 comments · Fixed by openedx/edx-platform#32955
Closed
Tracked by #155
Assignees
Labels
bug Report of or fix for something that isn't working as intended

Comments

@kdmccormick
Copy link
Collaborator

kdmccormick commented Jan 9, 2023

Background

In #155 we cataloged whether each edx-platform test fails, passes, or is skipped in both Devstack and Tutor Nightly (using edx-platform master, in Jan 2023).

This one test passes in Devstack but is skipped in Tutor: edx-platform:xmodule/capa/safe_exec/tests/test_safe_exec.py::TestSafeOrNot::test_cant_do_something_forbidden

Tasks

Fix the test or Tutor so that running:

tutor dev run lms bash
  lms> unset DJANGO_SETTINGS_MODULE
  lms> unset SERVICE_VARIANT
  lms> export EDXAPP_TEST_MONGO_HOST=mongodb
  lms> pytest 'xmodule/capa/safe_exec/tests/test_safe_exec.py::TestSafeOrNot::test_cant_do_something_forbidden'

in Tutor Nightly passes.

(test running instructions came from here: https://docs.tutor.overhang.io/dev.html#running-edx-platform-unit-tests)

Notes

safe_exec calls out to Codejail. So, this is likely the result of some Codejail configuration, or related environment setup, that Devstack has but Tutor does not.

The test can ran in Devstack with:

make lms-shell
  lms> pytest 'xmodule/capa/safe_exec/tests/test_safe_exec.py::TestSafeOrNot::test_cant_do_something_forbidden'
@kdmccormick kdmccormick self-assigned this Jan 9, 2023
@kdmccormick kdmccormick added the bug Report of or fix for something that isn't working as intended label Jan 9, 2023
@kdmccormick kdmccormick changed the title Fix test in Tutor: edx-platform:TestSafeOrNot:test_cant_do_something_forbidden Fix edx-platform test TestSafeOrNot:test_cant_do_something_forbidden in Tutor Jan 9, 2023
@kdmccormick kdmccormick changed the title Fix edx-platform test TestSafeOrNot:test_cant_do_something_forbidden in Tutor Fix test edx-platformTestSafeOrNot:test_cant_do_something_forbidden in Tutor Jan 9, 2023
@kdmccormick kdmccormick changed the title Fix test edx-platformTestSafeOrNot:test_cant_do_something_forbidden in Tutor Fix test edx-platform:TestSafeOrNot:test_cant_do_something_forbidden in Tutor Jan 9, 2023
@kdmccormick kdmccormick moved this from 📥 New to 📋 Refined in Developer Experience Working Group Jan 9, 2023
@kdmccormick kdmccormick changed the title Fix test edx-platform:TestSafeOrNot:test_cant_do_something_forbidden in Tutor Run edx-platform:TestSafeOrNot:test_cant_do_something_forbidden in Tutor Jan 11, 2023
@kdmccormick kdmccormick changed the title Run edx-platform:TestSafeOrNot:test_cant_do_something_forbidden in Tutor Run TestSafeOrNot:test_cant_do_something_forbidden in Tutor Jan 11, 2023
@kdmccormick kdmccormick removed their assignment Jan 11, 2023
@solababs
Copy link

solababs commented Aug 1, 2023

@kdmccormick I am working on this issue and here is what i have found
From the security issue mentioned here overhangio/tutor#443 we see that the python interpreter is explicitly disabled.
How do we want to go about this now?
cc @xitij2000

@xitij2000
Copy link

@solababs Looking into this issue I see that you can use the plugin tutor-contrib-codejail plugin to enable codejail.

Does enabling that plugin allow the test to run? Does it pass? If so, I personally feel this issue can be closed since the test can pass on tutor.

@solababs
Copy link

solababs commented Aug 9, 2023

@xitij2000 Thanks for your help on this. I have been able to adequately implement tutor-contrib-codejail and the the test passed on tutor.
Please let me know what to do with this ticket.

@xitij2000
Copy link

@xitij2000 Thanks for your help on this. I have been able to adequately implement tutor-contrib-codejail and the the test passed on tutor. Please let me know what to do with this ticket.

Can you create a PR againt edx-platform that changes the condition in which the test is considered skipped? The test should run if tutor is configured with the codejail service.

@solababs
Copy link

solababs commented Aug 9, 2023

@xitij2000 please see linked PR openedx/edx-platform#32955

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Report of or fix for something that isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants