• Kirill Smelkov's avatar
    fixup! trun: Spawn user test with sole regular uid/gid in /etc/{passwd,group} database · 6f75fa90
    Kirill Smelkov authored
    Even though slapos.core tests seem to mock getgrnam calls[1], disk group
    is being looked up in /etc/groups for real which fails, if there is no
    such group, e.g. as
    
        ERROR: test_not_existing (slapos.tests.test_slapgrid.TestSlapgridWithDevPermManagerDevPermEmptyLsblk)
        ----------------------------------------------------------------------
        Traceback (most recent call last):
          File "/srv/slapgrid/slappart3/t/bvi/i/0/parts/slapos.core/slapos/tests/test_slapgrid.py", line 3246, in setUp
            self.setUpExpected()
          File "/srv/slapgrid/slappart3/t/bvi/i/0/parts/slapos.core/slapos/tests/test_slapgrid.py", line 3230, in setUpExpected
            gid = grp.getgrnam("disk").gr_gid
        KeyError: 'getgrnam(): name not found: disk'
    
    -> Fix it up by also creating "disk" group in our namespace environment.
    
    I'm not sure, but maybe the better long-term fix would be for
    slapos.core tests not to access /etc/groups for real and to instead mock
    access to this database completely.
    
    Amends commits e6b7993c and b42ccfa5.
    
    /reported-by @tomo
    /reported-at slapos!1107 (comment 148758)
    
    [1] https://lab.nexedi.com/nexedi/slapos.core/blob/1.7.1-28-g0b6bf2af4/slapos/tests/test_slapformat.py#L160-166
    6f75fa90
Name
Last commit
Last update
nxdtest Loading commit data...
.gitignore Loading commit data...
.nxdtest Loading commit data...
COPYING Loading commit data...
pytest.ini Loading commit data...
setup.py Loading commit data...