Bug 34280 - Test helpdesk module
Test helpdesk module
Product: UCS@school
Classification: Unclassified
Component: ucs-test
UCS@school 3.2 R2
Other Linux
: P5 normal (vote)
: ---
Assigned To: Ammar Najjar
Sönke Schwardt-Krummrich
Depends on:
  Show dependency treegraph
Reported: 2014-03-07 09:58 CET by Sönke Schwardt-Krummrich
Modified: 2014-06-18 10:11 CEST (History)
0 users

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2014-03-07 09:58:31 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.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2014-03-14 07:59:03 CET
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.
Comment 2 Ammar Najjar univentionstaff 2014-03-17 10:04:43 CET
Test name: ucs-school-helpdesk-check
Packages required: ucs-school-umc-helpdesk
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.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2014-04-14 21:45:30 CEST
OK: Implementation
OK: Test
Entry in UCS@school 3.2R2 changelog has been added.
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2014-04-14 21:52:53 CEST
Please set "exposure" in the ucs-test header to "careful".
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2014-04-15 08:21:23 CEST
(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.
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2014-04-29 16:17:56 CEST
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
Comment 7 Ammar Najjar univentionstaff 2014-04-30 11:35:10 CEST
# Workaround for bug 31837 added.
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2014-06-11 11:11:07 CEST
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 ( to a local port (e.g. 60025). The mail sink should be started on 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.
Comment 9 Ammar Najjar univentionstaff 2014-06-12 09:45:46 CEST
 - 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.
Comment 10 Sönke Schwardt-Krummrich univentionstaff 2014-06-18 10:11:25 CEST
Tested successfully on singlemaster and slave. The mail transfer to the MX of univention.de is intercepted and redirected to the local mailsink.