Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #8585 (closed)

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

chmod gatewaytests

Reported by: wmoore Owned by: jamoore
Priority: major Milestone: OMERO-4.4
Component: Services Version: n.a.
Keywords: n.a. Cc: atarkowska, cxallan, jburel, cneves
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: 2012-05-08 (14)

Description

Josh - I'm having some trouble with the chmod.py gatewaytest in branch like this:

$ git graph
*   2b9be8d (HEAD, joshmoore/2874-chmod, chmod_web_8434) Merge branch '8565-acl-voter' into HEAD
|\  
| * 1acdbae Grant annotate/link to supervisors except where group critical
| * df7f17e Critical: AllGroups filtering on group permissions
| * 3eace29 Second attempt at force-loading group permissions
| * 040b24e Cache and replace DUMMY permissions by group id
|/  
*   e7b3fac Merge branch '8434-fix-chmod-test' into HEAD

I initially got lots of these:

$ python gatewaytest/chmod.py 
...
Traceback (most recent call last):
  File "gatewaytest/chmod.py", line 363, in setUp
    super(ManualCreateEditTest, self).setUp()
  File "gatewaytest/chmod.py", line 49, in setUp
    raise Exceptions("Missing permissions for %s" % name)
NameError: global name 'Exceptions' is not defined

Then I fixed the import with

import exceptions
...
    raise exceptions.Exception(..

but now I get lots of these

$ python gatewaytest/chmod.py 
.EEEEE
======================================================================
ERROR: In a read-annotate group, user should be able to Annotate but NOT Edit
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gatewaytest/chmod.py", line 266, in setUp
    super(CustomUsersTest, self).setUp()
  File "gatewaytest/chmod.py", line 50, in setUp
    raise exceptions.Exception("Missing permissions for %s" % name)
Exception: Missing permissions for ReadOnly_chmod_group
...
----------------------------------------------------------------------
Ran 6 tests in 7.178s

FAILED (errors=5)

Change History (11)

comment:1 Changed 7 years ago by jmoore

  • Resolution set to fixed
  • Status changed from new to closed

Interesting. The test passes for me despite the two issues you found. Exceptions was definitely a typo (sorry!) and should just be Exception. import exceptions isn't necessarily but certainly doesn't hurt. The other issue is part of a bigger change I made to the tests. If a groupname is set, then a groupperms value must also be provided, so that you are sure that the group is in the expected state on re-use. (This bit me many times.)

Pushed the following commit to my branch:

commit 6360eddc85a8f9b0e74e3658991e3d036d1b5a79
Author: jmoore <josh@glencoesoftware.com>
Date:   Fri Apr 20 08:55:40 2012 +0200

    Minor fixes for gatewaytest/chmod.py (Fix #8585)

diff --git a/components/tools/OmeroPy/test/gatewaytest/chmod.py b/components/tools/OmeroPy/test/gatewaytest/chmod.py
index a7e96d3..ef46cb0 100644
--- a/components/tools/OmeroPy/test/gatewaytest/chmod.py
+++ b/components/tools/OmeroPy/test/gatewaytest/chmod.py
@@ -46,7 +46,7 @@ class ChmodBaseTest (lib.GTest):
                     if not name:
                         continue # These are likely the weblitz tests
                     else:
-                        raise Exceptions("Missing permissions for %s" % name)
+                        raise Exception("Missing permissions for %s" % name)
                 try:
                     group = admin.lookupGroup(name)
                     if str(perms) != str(group.details.permissions):
@@ -190,7 +190,7 @@ class ChmodGroupTest (ChmodBaseTest):
         dbhelpers.USERS['chmod_group_admin'] = dbhelpers.UserEntry('r-_chmod_admin','ome', firstname='chmod', lastname='admin',
                    groupname="ReadOnly_chmod_group", groupperms=READONLY, admin=True)
         dbhelpers.USERS['chmod_group_owner'] = dbhelpers.UserEntry('r-_chmod_owner','ome', firstname='chmod', lastname='owner',
-                   groupname="ReadOnly_chmod_group", groupowner=True)
+                   groupname="ReadOnly_chmod_group", groupperms=READONLY, groupowner=True)
         # Calling the superclass setUp processes the dbhelpers.USERS etc to populate DB
         super(ChmodGroupTest, self).setUp()
 

comment:2 Changed 7 years ago by wmoore

Hmmm - Still not working for me I'm afraid.

======================================================================
ERROR: In a read-only group, user should NOT be able to Edit or Annotate
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gatewaytest/chmod.py", line 363, in setUp
    super(ManualCreateEditTest, self).setUp()
  File "gatewaytest/chmod.py", line 49, in setUp
    raise Exception("Missing permissions for %s" % name)
Exception: Missing permissions for weblitz_test_author_group

----------------------------------------------------------------------
Ran 6 tests in 7.994s

FAILED (errors=5)

Also the permissions don't seem to be behaving in webclient. I am able to create new Datasets etc under another user's Projects in a 'rwra-a' group.

Let's discuss on Monday!

comment:3 Changed 7 years ago by jmoore

Hmmm - Still not working for me I'm afraid.

Exception: Missing permissions for weblitz_test_author_group

All of your UserEntries must have a groupperms field. And then you may still get exceptions because your database may just be wonked from the gateway tests doing things willy-nilly. I had to drop mine several times, which is why I've put these constraints in place.

Also the permissions don't seem to be behaving in webclient. I am able to create new Datasets etc under another user's Projects in a 'rwra-a' group.

Do you have a test with a "rwra-a" group? I certainly didn't write any with that specifically in mind.

comment:4 Changed 7 years ago by jmoore

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 7 years ago by jburel

  • Sprint changed from 2012-04-24 (13) to 2012-05-08 (14)

Moved from sprint 2012-04-24 (13)

comment:6 Changed 7 years ago by wmoore

Tried running tests on a clean db - One test still failing:

$ python gatewaytest/chmod.py 
I<./../bin/omero -s localhost -k 682f720c-ac98-47ec-8b76-d970f6643324 -p 4064 import -d 3 -n weblitz_test_priv_image2 /Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/imgs/CHOBI_d3d.dv
I./../bin/omero -s localhost -k 1c0df843-21ed-4a31-872f-d74f1699bd77 -p 4064 import -d 3 -n weblitz_test_priv_image /Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/imgs/CHOBI_d3d.dv
I<./../bin/omero -s localhost -k bfb8f23e-fa46-43f5-8dff-04eeff4b6e4d -p 4064 import -d 2 -n weblitz_test_priv_image_tiny3 /Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/imgs/tinyTest.d3d.dv
I./../bin/omero -s localhost -k 2fdad398-eb58-4a8e-88a6-a81ba377a21a -p 4064 import -d 1 -n weblitz_test_priv_image_tiny2 /Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/imgs/tinyTest.d3d.dv
II./../bin/omero -s localhost -k 0b1a4526-d0b5-4c15-864f-db8506a94e5a -p 4064 import -d 3 -n weblitz_test_priv_image_tiny /Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/imgs/tinyTest.d3d.dv

....E.
======================================================================
ERROR: testAuthorCanEdit (__main__.DefaultSetupTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gatewaytest/chmod.py", line 388, in setUp
    self.AUTHOR.check_group_perms(self.gateway, ctx.groupName, "rw----")
  File "/Users/will/Desktop/OMERO/dist/lib/python/omero/gateway/scripts/dbhelpers.py", line 152, in check_group_perms
    (groupname, groupperms, p))
BadGroupPermissionsException: weblitz_test_author_group group has wrong permissions! Expected: rw---- Found: rwr---

----------------------------------------------------------------------
Ran 6 tests in 142.407s

FAILED (errors=1)

comment:7 Changed 7 years ago by jmoore

That still looks lik a related issue, Will, i.e. the "weblitz_test_author_group" has already been modified in a previous test run and therefore is not "rwr" as expected. If you'd like to confirm that, you can use the command line to change the permissions to rwr (bin/omero group perms --perms=rwr---) and then re-run. But you may need to re-run just the one individual test, otherwise a previous test could again chmod the weblitz_test_author_group.

comment:8 Changed 7 years ago by wmoore

OK, so that got the test to pass:

$ omero group perms --perms rw---- weblitz_test_author_group

$ python gatewaytest/chmod.py DefaultSetupTest.testAuthorCanEdit
.
----------------------------------------------------------------------
Ran 1 test in 2.427s

OK

But I don't understand why we're expecting that group to be rw---- when it's really rwr---. These tests are not a lot of use if we can't even run all of the chmod tests at the same time.

comment:9 Changed 7 years ago by jmoore

But I don't understand why we're expecting that group to be rw---- when it's really rwr---.

That may be a configuration error. You're welcome to revert it to rwr--- if that's also what Carlos is expecting.

These tests are not a lot of use if we can't even run all of the chmod tests at the same time.

Agreed, these tests which re-use groups are currently only limitedly useful, since chmod'ing a group is a permanent change, unless each test takes care to roll back the state of the group, regardless of whether it passes or fails.

Last edited 7 years ago by jmoore (previous) (diff)

comment:10 Changed 7 years ago by wmoore

  • Resolution set to fixed
  • Status changed from reopened to closed

OK, it seems that these tests are now running repeatedly for me (without having to reset perms on CLI!). With some extra printing out, this looks like:

$ python gatewaytest/chmod.py
doChange: 3 rwr---
ca277c05-15d3-4725-90d4-7246e280810e/IHandle0ea2b627-a9cc-43ac-9a82-2d838e066eb5 -t:tcp -h 10.128.208.143 -p 51634:tcp -h 10.12.1.49 -p 51634
doChange: 3 rwrw--
cf2e70c8-5446-43c8-98cc-65f5919ff5e1/IHandle799d571e-b244-4bcc-b70b-9ee192804b20 -t:tcp -h 10.128.208.143 -p 51634:tcp -h 10.12.1.49 -p 51634
.canEdit() True
canEdit() False
canEdit() True
canEdit() True
.canEdit() True
canEdit() False
canEdit() True
canEdit() True
.canEdit() True
canEdit() True
canEdit() True
canEdit() True
.canEdit() True
canEdit() True
.canEdit() False
.
----------------------------------------------------------------------
Ran 6 tests in 18.885s

OK

comment:11 Changed 7 years ago by jmoore <josh@…>

  • Remaining Time set to 0

(In [6360eddc85a8f9b0e74e3658991e3d036d1b5a79/ome.git] on branch develop) Minor fixes for gatewaytest/chmod.py (Fix #8585)

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.80680 sec.)

We're Hiring!