-
Notifications
You must be signed in to change notification settings - Fork 10
Add "test connection" functionality in GUI and cli #13
Comments
I'm not aware of any tests written for this yet. It probably would make sense to have a "test connection" button in the admin section. And if you did that, you could also use the same code to make a CLI script, which could be useful for things like nagios. However, Moodle HQ probably isn't going to be accepting any enhancements to MNet into Moodle core any time soon, because MNet is still in the (lengthy) process of being replaced. We could put a test page into Mahara or into this plugin, though. Or a Moodle plugin that just adds an Mnet test button. |
Aaron, Do you have any recommendations on how we could go about testing? I can have my student worker take a stab at developing a test page with a button in the admin panel. I'm just not sure how the test would function. Would we just attempt an XMLRPC connection from Moodle -> Mahara and verify there is a response with no errors? |
Sorry, an Mnet connection. |
Hi Tony, I think the most sensible thing would be if Moodle sends an XMLRPC request to Mahara (and/or vice-versa). MNet uses XMLRPC as the communication medium, and all XMLRPC really is, is a way to make a function calls across the network (plus some authentications and stuff). If you look in Mahara at the file htdocs/api/xmlrpc/dispatcher.php, you can see a list of all the functions that Mahara exposes via XMLRPC. They're in the Dispatcher->services['sso_out'] array, which maps them from an XMLRPC method name, to an actualy PHP function. This array is a bit confusing, because the XMLRPC method names look like filenames, but they're actually arbitrary strings. For instance, when the assignment submission plugin in Moodle is requesting a list of all of a user's views from Mahara, it sends a request to Mahara for the method 'mod/assignment/type/mahara/rpclib.php/get_views_for_user', which causes Mahara to locally run the function "get_views_for_user()" in api/xmlrpc/lib.php, and return the values from that. Unfortunately there isn't a basic "get_status" XMLRPC method or anything like that, in either Moodle or Mahara. But perhaps you could call "auth/mnet/auth.php/user_authorise" with an invalid username, and then check whether you get back a "no such user" response, or a "could not connect" response. To summarize some of the useful code locations:
Cheers, |
A user on the Moodle forums sent me a message with a request:
"I work for the University of Montreal, we are using Mahara 1.10.2, Moodle 2.7 with the new versions of plugins for assign submission and feedback from Mahara.
We would like to have an automated test that can detect if my Moodle-Mahara integration is working fine. In other words, any kind of integration test that can check the SSO, exporting files from Moodle to Mahara, and any others shared functionalities. I would like to run it daily and be alerted if there is something that doesn't work.
Do you know if anybody in the community use some kind of test for that? Behat tests? Unit tests?
Thanks in advance!"
I mentioned that once you get the initial setup working, there should be no problems going into the future unless, possibly, you have Mahara and Moodle installed on separate servers in which case there are more potential points of failure (firewall, SSH keys, etc).
Either way, I thought it might be nice to have a feature that tests your connection between Moodle and Mahara to make sure page submitting will work. This could be accessed via a menu in Moodle that just says "connection successful!" and also a cli script that could be set to run on a cron (if someone wanted notifications on failures).
Obviously not a priority but it could be a nice long-term goal.
Now that I think about it, maybe this would be more appropriate for general XMLRPC connections in Moodle to other software, since that's ultimately what would be the cause of failure.
The text was updated successfully, but these errors were encountered: