From baf4f76d97da9c57f6a6fb0a22ed4cb69f47dbbb Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Tue, 23 Nov 2021 10:28:47 +0000 Subject: [PATCH] docs: More detail on running tests as different users Add some more detail to the unit test advice document about running tests as different users. Signed-off-by: James O. D. Hunt --- docs/Unit-Test-Advice.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/Unit-Test-Advice.md b/docs/Unit-Test-Advice.md index cc46486a08..b877f8eb86 100644 --- a/docs/Unit-Test-Advice.md +++ b/docs/Unit-Test-Advice.md @@ -268,12 +268,9 @@ mod tests { When writing a test consider which user should run it; even if the code the test is exercising runs as `root`, it may be necessary to *only* run the test -as a non-`root` for the test to be meaningful. - -Some repositories already provide utility functions to skip a test: - -- if running as `root` -- if not running as `root` +as a non-`root` for the test to be meaningful. Add appropriate skip +guards around code that requires `root` and non-`root` so that the test +will run if the correct type of user is detected and skipped if not. ### Run Golang tests as a different user