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 fails on Debian #17366

Closed
siretart opened this issue Feb 4, 2023 · 4 comments · Fixed by #17378
Closed

Test fails on Debian #17366

siretart opened this issue Feb 4, 2023 · 4 comments · Fixed by #17378
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@siretart
Copy link
Contributor

siretart commented Feb 4, 2023

assert.Equal(t, user, "123:*:123:456:container user:/:/bin/sh\n")

This test fails on my Debian laptop with:

=== RUN   TestGenerateUserPasswdEntry
    container_internal_linux_test.go:29: 
        	Error Trace:	/<<PKGBUILDDIR>>/_output/src/github.com/containers/podman/libpod/container_internal_linux_test.go:29
        	Error:      	Not equal: 
        	            	expected: "_flatpak:*:123:456:Flatpak system-wide installation helper:/:/bin/sh\n"
        	            	actual  : "123:*:123:456:container user:/:/bin/sh\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-_flatpak:*:123:456:Flatpak system-wide installation helper:/:/bin/sh
        	            	+123:*:123:456:container user:/:/bin/sh
        	            	 
        	Test:       	TestGenerateUserPasswdEntry
--- FAIL: TestGenerateUserPasswdEntry (0.00s)
@siretart
Copy link
Contributor Author

siretart commented Feb 4, 2023

Does this test make assumptions about the system wide /etc/passwd?

@vrothberg
Copy link
Member

@mheon PTAL

@mheon
Copy link
Member

mheon commented Feb 6, 2023

It appears it makes an assumption that UID/GID 123:456 do not exist on the host system. Changing the UID/GID used in the test to something else (probably want to go 6 digits at least on both, to prevent collisions) should fix.

@mheon
Copy link
Member

mheon commented Feb 6, 2023

#17378 to fix

mheon added a commit to mheon/libpod that referenced this issue Feb 7, 2023
The tests for generating username/passwd entries assume that
UID/GID 123/456 do not exist, which is not a safe assumption on
Debian. If a /etc/passwd entry with that UID/GID already exists,
the test will not add a new one with the same UID/GID, and will
fail. Change UID and GID to be 6 digits, because we're a lot less
likely to collide with UIDs and GIDs in use on the system that
way. Could also go further and randomly generate the UID/GID, but
that feels like overkill.

Fixes containers#17366

Signed-off-by: Matt Heon <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants