Bug 35620 - [ucs-test] test UCS@school module for creating computer rooms
[ucs-test] test UCS@school module for creating computer rooms
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: ucs-test
UCS@school 3.2 R2
Other Linux
: P5 normal (vote)
: ---
Assigned To: Ammar Najjar
Florian Best
:
Depends on:
Blocks: 35278 38003
  Show dependency treegraph
 
Reported: 2014-08-15 15:23 CEST by Sönke Schwardt-Krummrich
Modified: 2016-11-03 17:37 CET (History)
2 users (show)

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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2014-08-15 15:23:43 CEST
Please write an ucs-test script that will test the UCS@school room module that is used to create, modify and delete computerrooms. Please also test if computers may be assigned to/removed from a computerroom.
Comment 1 Ammar Najjar univentionstaff 2014-08-19 11:32:54 CEST
A new script with the name "25_room_management_module" is created to include:
 - Testing creating new computer room.
 - Testing the UMCP get,query commands.
 - Test editing the exiting room.
 - Test creating new room with the same name (fails)
 - Test removing the created room.

Tested on single server and multi server environments.

This script currently fails because of Bug #35166.
Comment 2 Florian Best univentionstaff 2014-08-21 10:12:32 CEST
parameter name spelled incorrectly:
accept_doublicate_name

doublicate → duplicate
Comment 3 Ammar Najjar univentionstaff 2014-08-21 10:21:39 CEST
(In reply to Florian Best from comment #2)
> parameter name spelled incorrectly:
> accept_doublicate_name
> 
> doublicate → duplicate

Spelling mistake corrected. 
Class SchoolRoom renamed to be ComputerRoom as suggested.
Comment 4 Florian Best univentionstaff 2014-08-22 08:05:05 CEST
Ammar, can you please adapt this script to fit the current response. It currently fails because of changes in Bug 35278 because some dict keys (objectType, hosts) were added. You can simply strip them out of the response before the comparison.

And maybe: accept_duplicate_name → accept_duplicated_name
Comment 5 Ammar Najjar univentionstaff 2014-08-22 11:17:14 CEST
(In reply to Florian Best from comment #4)
> Ammar, can you please adapt this script to fit the current response. It
> currently fails because of changes in Bug 35278 because some dict keys
> (objectType, hosts) were added. You can simply strip them out of the
> response before the comparison.
> 
> And maybe: accept_duplicate_name → accept_duplicated_name

Done.
Comment 6 Florian Best univentionstaff 2015-01-19 13:05:01 CET
The test script contains the following lines:

            # Test creating new room with the same name
            room2 = ComputerRoom(school, name=room.name, host_members=[computers_dns[1]])
            room2.add(accept_duplicated_name=True)

→ There is no check whether the room really failed to be created (and it currently does not fail, the log does not contain "Cought an expected exception: %s".
→ Also a check whether the values of room1 are the same as before after the failed command is missing.

Logfile:
Calling schoolrooms/get for cn=8058-new_name,cn=raeume,cn=groups,ou=8058,dc=mydomain,dc=intranet
Adding school room new_name with UMCP:schoolrooms/add
param = [{'object': {'school': '8058', 'computers': ['cn=f4dyngbclt,cn=computers,ou=8058,dc=mydomain,dc=intranet'], 'name': 'new_name', 'description': 'ggfa44pgfl'}, 'options': None}]
Waiting for replication:
OK: replication complete (nid=2297 lid=2297)
Done: replication complete.
Comment 7 Ammar Najjar univentionstaff 2015-01-20 09:23:36 CET
(In reply to Florian Best from comment #6)
> The test script contains the following lines:
> 
>             # Test creating new room with the same name
>             room2 = ComputerRoom(school, name=room.name,
> host_members=[computers_dns[1]])
>             room2.add(accept_duplicated_name=True)
> 
> → There is no check whether the room really failed to be created (and it
> currently does not fail, the log does not contain "Cought an expected
> exception: %s".

The check is included inside the add function.
The module is changed since the time of writing this script, so instead of:
1- return True if addition is successful.
2- throw an exception if add is not successful with a description of the reason.
now it returns always an array, where it contains:
1- element true, if add is successful.
2- element false, if add is not successful.
Funny enough, the old test script still passes after these changes.
I changed the checks to fit the new circumstances.


> → Also a check whether the values of room1 are the same as before after the
> failed command is missing.

I do not see why such a check is needed. It is added though.
Comment 8 Florian Best univentionstaff 2015-02-05 16:54:13 CET
Can you adapt check_query() to fit into the same scheme as in the other classes → to accept a list as argument.

comment #6 is still valid.
You need to do something like:
room2.verify_ldap(False)
after adding it. It must not exist.
Comment 9 Ammar Najjar univentionstaff 2015-02-10 09:09:32 CET
(In reply to Florian Best from comment #8)
> Can you adapt check_query() to fit into the same scheme as in the other
> classes → to accept a list as argument.
> 

Done.

> comment #6 is still valid.
> You need to do something like:
> room2.verify_ldap(False)
> after adding it. It must not exist.

This is not possible as long as the DN of an ldap objects is a unique attribute. The script is testing creating a new room with the same name as an existing room, it should fail on the front end, but the ldap object still exists.
Comment 10 Florian Best univentionstaff 2015-02-10 11:43:43 CET
(In reply to Ammar Najjar from comment #9)
> > comment #6 is still valid.
> > You need to do something like:
> > room2.verify_ldap(False)
> > after adding it. It must not exist.
> 
> This is not possible as long as the DN of an ldap objects is a unique
> attribute. The script is testing creating a new room with the same name as
> an existing room, it should fail on the front end, but the ldap object still
> exists.
yes, you are right but the test script now does not fail if the creation of the room would succeed. "should_fail" is only evaluated if "not reqResult[0]".
Comment 11 Ammar Najjar univentionstaff 2015-02-11 09:39:08 CET
(In reply to Florian Best from comment #10)
> (In reply to Ammar Najjar from comment #9)
> > > comment #6 is still valid.
> > > You need to do something like:
> > > room2.verify_ldap(False)
> > > after adding it. It must not exist.
> > 
> > This is not possible as long as the DN of an ldap objects is a unique
> > attribute. The script is testing creating a new room with the same name as
> > an existing room, it should fail on the front end, but the ldap object still
> > exists.
> yes, you are right but the test script now does not fail if the creation of
> the room would succeed. "should_fail" is only evaluated if "not
> reqResult[0]".

Right, corrected.
Comment 12 Florian Best univentionstaff 2015-02-11 16:54:41 CET
Ok, seems good now.