Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure if user is not in a second usergroup (1.5.3.rc1, Fedora 41) #1912

Closed
buhtz opened this issue Oct 24, 2024 · 0 comments · Fixed by #1913
Closed

Test failure if user is not in a second usergroup (1.5.3.rc1, Fedora 41) #1912

buhtz opened this issue Oct 24, 2024 · 0 comments · Fixed by #1913
Assignees
Labels
Bug Distro-Specific only for certain distributions, desktop environments or display servers

Comments

@buhtz
Copy link
Member

buhtz commented Oct 24, 2024

First reported in #1911 by @hannes101 and moved into its own issue here.

The test TestRestorePathInfo.test_change_group failes because the testing user is not member in a second usergroup.
This happens in Fedora 41 build environments which use mock (chroot) to isolate the build.

____________________ TestRestorePathInfo.test_change_group _____________________
self = <test.test_snapshots.TestRestorePathInfo testMethod=test_change_group>
    def test_change_group(self):
>       newGroup = [x for x in GROUPS if x != CURRENTGROUP][0]
E       IndexError: list index out of range
test/test_snapshots.py:608: IndexError

The constant CURRENTGROUP is created in common/test/constants.py:

import grp
import os
import pwd


CURRENTUID = os.geteuid()
CURRENTUSER = pwd.getpwuid(CURRENTUID).pw_name
CURRENTGID = os.getegid()
CURRENTGROUP = grp.getgrgid(CURRENTGID).gr_name
CURRENTUID = os.geteuid()
CURRENTGID = os.getegid()

GROUPS is created in common/test/test_snapshots.py:

GROUPS = [i.gr_name for i in grp.getgrall() if CURRENTUSER in i.gr_mem]

About a possible solution:

  1. I could skip the test if the len(GROUPS) < 2.
  2. But I would prefer if you could modify your build environment somehow. Might this be possible?
  3. I could raise an Exception if len(GROUPS) < 2 and instruct to add the user to a second group. It would be an instruction for distro maintainers.

It was recommended to use solution 1.

@buhtz buhtz self-assigned this Oct 24, 2024
@buhtz buhtz added the Bug label Oct 24, 2024
@buhtz buhtz added this to the 1.5.3 (Upcoming release) milestone Oct 24, 2024
@buhtz buhtz added the Distro-Specific only for certain distributions, desktop environments or display servers label Oct 26, 2024
buhtz added a commit that referenced this issue Oct 30, 2024
A test (test_change_group()) is skipped if the environment is not setup accordingly (current user in minimum 2 usergroups).

Fix #1912
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Distro-Specific only for certain distributions, desktop environments or display servers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant