Univention Bugzilla – Bug 34280
Test helpdesk module
Last modified: 2023-03-25 06:40:04 CET
A ucs-test script should check the UCS@school helpdesk module: - e.g. set "root@localhost" via UCR as recipient for helpdesk mails - connect via python UMCConnection() class to UMC and send UMCP command for creating a new message to the helpdesk team. The message should contain an unique identifier. - check /var/mail/root periodically until selfdefined timeout occurs or the unique identifier has been found.
As discussed yesterday, a new OU and a teacher user should be created by the test script. The teacher user shall be used to connect to UMC and call the UMCP command "helpdesk/send" to send a message to the helpdesk team (== root@localhost). Unlike stated above the mail is stored in /var/mail/systemmail instead of /var/mail/root (with default settings, mails for user root will be redirected to the user systemmail). There is a new small python class for UCS@school testing in the package ucs-test-ucsschool. It's called UCSTestSchool and is able to create new OUs (create_ou()) and new users (create_user()) and cleans up afterwards automatically if the "with" statement is used. Otherwise the cleanup() function has to be called manually.
Test name: ucs-school-helpdesk-check Packages required: ucs-school-umc-helpdesk Description: creates a dump user with teacher privileges and try to send a message to the helpdesk. The message contains a unique identifier represented by the time stamp in milliseconds. During an interval of 10 sec it checks if the message was delivered to the helpdesk mail file. Succeeds if true.
OK: Implementation OK: Test Entry in UCS@school 3.2R2 changelog has been added.
Please set "exposure" in the ucs-test header to "careful".
(In reply to Sönke Schwardt-Krummrich from comment #4) > Please set "exposure" in the ucs-test header to "careful". I just reread the ucs-test definitions: please set "exposure" to "dangerous", because new OUs and users are created by the test script. (http://wiki.univention.de/index.php?title=Ucs-test#exposure)
Due to bug 31837 the mail delivery for root@localhost is broken. Possible workaround: --- a/ucs-school-3.2r2/ucs-test-ucsschool/90_ucsschool/03_ucs-school-helpdesk-check +++ b/ucs-school-3.2r2/ucs-test-ucsschool/90_ucsschool/03_ucs-school-helpdesk-check @@ -11,8 +11,11 @@ import sys, time import univention.testing.ucr as ucr_test import univention.testing.ucsschool as utu import univention.testing.utils as utils +import subprocess def main(): + subprocess.call(['/usr/bin/newaliases']) # Workaround for bug 31837 + # initializing mail data message = time.time() * 1000 message = '%.30f' % message
# Workaround for bug 31837 added.
Currently the test does not work if univention-mail-server is not installed. As discussed, please use the NetworkRedirector from univention/testing/network.py and the mail sink from univention/testing/mail.py. The NetworkRedirector should redirect all outgoing connections to port 25 (0.0.0.0:25) to a local port (e.g. 60025). The mail sink should be started on 127.0.0.1:60025 and write all mails to a single file. As helpdesk mail address please use ucstest@univention.de. A valid DNS MX entry for the specified address is required, so I think ucstest@univention.de will do the job. In case the network redirection fails, the MX will reject the unknown address.
- Workaround for bug 31837 removed (not needed any more) - Test does not depend on "univention-mail-server" any more. It uses NetworkRedirector and MailSink classes as explained in comment 8.
Tested successfully on singlemaster and slave. The mail transfer to the MX of univention.de is intercepted and redirected to the local mailsink. → VERIFIED