Code review comment for ~andersson123/autopkgtest-cloud:revive_unit_tests

Revision history for this message
Paride Legovini (paride) wrote (last edit ):

I added some drive-by comments, not a full review.

Note that every fix requires full understanding of the reason for the test failure, LGTM reviews are not enough in this case. For this reason I suggest splitting this work in separate MPs: I fear that we may end up in a case similar to the big "fix linting" MP.

I'd start by fixing the need to run the unit tests as root. The issue happens even when no test is run, and this case is reproducible in this way:

$ cd charms/focal/autopkgtest-web/webcontrol
$ python3 -m unittest -k I-do-not-exist
[errors]

I think one sensible way to fix this is replacing:

PATH = os.path.join(os.path.sep, "run", "autopkgtest_webcontrol")

with:

PATH = os.path.join(os.path.sep, os.getenv("XDG_RUNTIME_DIR", "/run"), "autopkgtest_webcontrol")

See [1] if you are not familiar with XDG_* variables.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

review: Needs Fixing

« Back to merge proposal