-
Bug
-
Resolution: Fixed
-
Critical
-
3.11.6, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
-
MDL-74096-master -
-
Moppies Kanban
It seems that unit tests are not passing against the python mlbackend.
To reproduce
- Run the mlbackend docker image:
docker run -d -p 5000:5000 moodlehq/moodle-mlbackend-python:3.0.2-python3.7.5
- Setup the needed constants in config.php:
define('TEST_MLBACKEND_PYTHON_HOST', 'localhost');
define('TEST_MLBACKEND_PYTHON_PORT', 5000);
define('TEST_MLBACKEND_PYTHON_USERNAME', 'default');
define('TEST_MLBACKEND_PYTHON_PASSWORD', 'sshhhh');
- Init PHPUnit and run the core_analytics_prediction_testcase testcase:
vendor/bin/phpunit -v --filter core_analytics_prediction_testcase
Expected
The tests pass ok.
Current status
There are errors (2) and failures (2)
Moodle 4.0beta (Build: 20220303), 87791a13a413498116fc5f081f5e48256f6e492f
|
Php: 8.0.16, mysqli: 8.0.27, OS: Darwin 20.6.0 x86_64
|
PHPUnit 9.5.13 by Sebastian Bergmann and contributors.
|
|
Runtime: PHP 8.0.16
|
Configuration: /Users/stronk7/git_moodle/testing/phpunit.xml
|
|
.....F.E.........F.....E.. 26 / 26 (100%)
|
|
Time: 02:49.630, Memory: 291.00 MB
|
|
There were 2 errors:
|
|
1) core_analytics_prediction_testcase::test_ml_export_import with data set "case-\mlbackend_python\processor-server" ('\mlbackend_python\processor', array(array(true, '127.0.0.1', 5000, false, 'default', 'sshhhh')))
|
moodle_exception: Server error HTTP status code 500: 1
|
|
/Users/stronk7/git_moodle/testing/lib/mlbackend/python/classes/processor.php:642
|
/Users/stronk7/git_moodle/testing/lib/mlbackend/python/classes/processor.php:401
|
/Users/stronk7/git_moodle/testing/analytics/classes/model_config.php:91
|
/Users/stronk7/git_moodle/testing/analytics/classes/model.php:1605
|
/Users/stronk7/git_moodle/testing/analytics/tests/prediction_test.php:392
|
/Users/stronk7/git_moodle/testing/lib/phpunit/classes/advanced_testcase.php:80
|
/private/tmp/composerbase/testing/400/vendor/phpunit/phpunit/phpunit:98
|
|
2) core_analytics_prediction_testcase::test_ml_evaluation_trained_model with data set "case-\mlbackend_python\processor-server" ('\mlbackend_python\processor', array(array(true, '127.0.0.1', 5000, false, 'default', 'sshhhh')))
|
moodle_exception: Server error HTTP status code 500: 1
|
|
/Users/stronk7/git_moodle/testing/lib/mlbackend/python/classes/processor.php:642
|
/Users/stronk7/git_moodle/testing/lib/mlbackend/python/classes/processor.php:401
|
/Users/stronk7/git_moodle/testing/analytics/classes/model_config.php:91
|
/Users/stronk7/git_moodle/testing/analytics/classes/model.php:1605
|
/Users/stronk7/git_moodle/testing/analytics/tests/prediction_test.php:684
|
/Users/stronk7/git_moodle/testing/lib/phpunit/classes/advanced_testcase.php:80
|
/private/tmp/composerbase/testing/400/vendor/phpunit/phpunit/phpunit:98
|
|
--
|
|
There were 2 failures:
|
|
1) core_analytics_prediction_testcase::test_ml_training_and_prediction with data set "quarters-\mlbackend_python\processor-server" ('\core\analytics\time_splittin...arters', 3, 4, '\mlbackend_python\processor', array(array(true, '127.0.0.1', 5000, false, 'default', 'sshhhh')))
|
Failed asserting that '0' matches expected 1.
|
|
/Users/stronk7/git_moodle/testing/analytics/tests/prediction_test.php:254
|
/Users/stronk7/git_moodle/testing/lib/phpunit/classes/advanced_testcase.php:80
|
/private/tmp/composerbase/testing/400/vendor/phpunit/phpunit/phpunit:98
|
|
2) core_analytics_prediction_testcase::test_ml_multi_classifier with data set "notimesplitting-\mlbackend_python\processor-server" ('\core\analytics\time_splittin...itting', '\mlbackend_python\processor', array(array(true, '127.0.0.1', 5000, false, 'default', 'sshhhh')))
|
Failed asserting that '1' matches expected 2.
|
|
/Users/stronk7/git_moodle/testing/analytics/tests/prediction_test.php:578
|
/Users/stronk7/git_moodle/testing/lib/phpunit/classes/advanced_testcase.php:80
|
/private/tmp/composerbase/testing/400/vendor/phpunit/phpunit/phpunit:98
|
|
ERRORS!
|
Tests: 26, Assertions: 213, Errors: 2, Failures: 2.
|
This has not been tested using local server mlbackend instalation. Only using the docker one. Also, it may affect older versions.
- blocks
-
MDLQA-16576 CLONE - Admins can change analytics settings and setup different machine learning backends
- Passed
-
MDLQA-16623 CLONE - An admin can set up the Python machine learning backend on a separate server
- Passed
- Discovered while testing
-
MDLQA-16576 CLONE - Admins can change analytics settings and setup different machine learning backends
- Passed