Skip to content
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

Set up the test sandbox configuration issue. #147

Open
good-moon-oooo opened this issue Sep 9, 2022 · 0 comments
Open

Set up the test sandbox configuration issue. #147

good-moon-oooo opened this issue Sep 9, 2022 · 0 comments

Comments

@good-moon-oooo
Copy link

good-moon-oooo commented Sep 9, 2022

Hello,

Thanks for working on this plugin.
We found that it might be not standard in Moodle that directly use the config files in the sandbox set-up.

public static function setup_test_sandbox_configuration(): void {
global $CFG, $USER;
require($CFG->dirroot . '/question/type/coderunner/tests/fixtures/test-sandbox-config-dist.php');
$localconfig = $CFG->dirroot . '/question/type/coderunner/tests/fixtures/test-sandbox-config.php';
if (is_readable($localconfig)) {
require($localconfig);
}

Because when we try to force config in our config files instead of changing anything in config-dist.php of this plugin
$CFG->forced_plugin_settings['qtype_coderunner']['jobesandbox_enabled'] = '1';

these forced configs finally will be overridden by what in function setup_test_sandbox_configuration()

Thus, the unit tests keep failing on our site.

Also, the way of using set_config in the config file might cause potential problems. It set the value directly in the file.

set_config('default_penalty_regime', '10, 20, ...', 'qtype_coderunner');
set_config('ideonesandbox_enabled', 0, 'qtype_coderunner');
set_config('jobesandbox_enabled', 0, 'qtype_coderunner');
set_config('jobe_host', 'localhost', 'qtype_coderunner');
set_config('jobe_apikey', '2AAA7A5415B4A9B394B54BF1D2E9D', 'qtype_coderunner');
set_config('ideone_user', 'coderunner', 'qtype_coderunner');
set_config('ideone_password', 'moodlequizzes', 'qtype_coderunner');
// Configuration extras, used only when testing.
set_config('jobe_apikey_enabled', 0, 'qtype_coderunner');
set_config('jobe_limits_enforced', 0, 'qtype_coderunner');

I guess it might be better to set the config value as constant variables and allow us to define constant variables somewhere else later (such as top-level config.php, etc).

Could you please reconsider these parts of the code and fix them? Thanks very much.

Reference reading when I look into the issue, maxima works on our site successfully. stack plugin doesn't set these values to be fixed values.
qytpe_stack plugin:
*https://github.com/maths/moodle-qtype_stack/blob/master/tests/fixtures/test_maxima_configuration.php
*https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Developer/Unit_tests.md

Thanks again.

Qi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant