-
Bug
-
Resolution: Done
-
Minor
-
None
-
4.3.2, 4.4
-
MOODLE_403_STABLE, MOODLE_404_STABLE
-
-
2
-
Team Hedgehog 2024 Sprint 3.2
We've been getting the following error related to Matrix in some PHPUnit builds:
- https://ci.moodle.org/job/S403.01.01%20-%20PHPUnit%20-%20Postgres/22/
- https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/14616/
Console output
1) core_communication\api_test::test_delete_room
|
GuzzleHttp\Exception\ServerException: Server error: `POST http://matrixmock8c310037ae729a66/hash43a9519ed4b5e9c75eb7d683e3d1e09708f9b34a/backoffice/create-admin` resulted in a `500 Internal Server Error` response:
|
<!-- App\Entity\Password::setPassword(): Argument #1 ($password) must be of type string, null given, called in /var/www/ (truncated...)
|
|
|
/var/www/html/lib/guzzlehttp/guzzle/src/Exception/RequestException.php:113
|
/var/www/html/lib/guzzlehttp/guzzle/src/Middleware.php:69
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:204
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:153
|
/var/www/html/lib/guzzlehttp/promises/src/TaskQueue.php:48
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:248
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:224
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:269
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:226
|
/var/www/html/lib/guzzlehttp/promises/src/Promise.php:62
|
/var/www/html/lib/guzzlehttp/guzzle/src/Client.php:187
|
/var/www/html/lib/guzzlehttp/guzzle/src/ClientTrait.php:95
|
/var/www/html/communication/provider/matrix/tests/matrix_test_helper_trait.php:49
|
/var/www/html/communication/provider/matrix/tests/matrix_test_helper_trait.php:107
|
/var/www/html/communication/tests/api_test.php:43
|
/var/www/html/lib/phpunit/classes/advanced_testcase.php:81
|
Discussed about this with huongn@moodle.com this is how it works when running matrix related unit tests:
1. Reset the mock data
2. Init mock config
2.1 Create admin user
2.2 Login as admin user.
The problem is the 2nd step does not wait for the 1st step to be completed.
So, if there are some problems at that time (Ex: Server performance), the reset process will take a lot of time to finish, so the create admin-user request will be rejected.
Looking at the Moodle code, we did not validation the response from the mock strictly and it would be good to make some extra conditions to make it more stable.