On Thursday, October 17th, 2024 at 11:27 PM, Colin Watson <cjwat...@debian.org> 
wrote:

> 

> 

> On Thu, Oct 17, 2024 at 07:42:18PM +0000, Daniel Markstedt wrote:
> 

> > I would like to ask your advice concerning autopkgtest.
> > At the moment, I'm preparing to set up an automated test suite for the 
> > "netatalk" package.
> > Netatalk is a file server daemon that you need to authenticate with through 
> > user credentials.
> > So in order to run end to end tests, one need to know the credentials of a 
> > user on the host:
> > Either an existing user's, or by creating new users on the fly.
> > 

> > My question is: How would one go about doing either of the above on the 
> > autopkgtest runner hosts?
> > I don't want to start running `useradd' before confirming that this is 
> > allowed,
> > and/or if there is a more sophisticated way to achieve my goals.
> 

> 

> Declaring "Restrictions: needs-root", running adduser or similar, and
> then dropping privileges to run the actual test is fine and sounds quite
> reasonable in this case. It'll all be done within the relevant testbed
> and thrown away at the end of the test. For example, openssh does
> something similar.
> 

> I suggest reading /usr/share/doc/autopkgtest/README.package-tests.html
> for the exact semantics of needs-root.
> 

> --
> Colin Watson (he/him) [cjwat...@debian.org]

Hi Colin,

Thanks you for sharing your advice. With this context I was able to make sense 
of the documentation.
In the end, I went with the "needs-sudo" restriction instead, to be able to run 
the actual test suite as non-root.

I'm using Perl and the Test::Simple module as the runner, and couldn't figure 
out how to drop to non-root when using the "needs-root" restriction.
I attempted setting the AUTOPKGTEST_NORMAL_USER environment variable 
subsequently in the Perl script, but it didn't take any effect with this 
particular test runner.

Anyways, I have a working test suite locally now, so this is just a note for 
the record!

Sincerely,
Daniel

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to