Skip to content
Snippets Groups Projects
Commit 8d100528 authored by Albert Gil's avatar Albert Gil
Browse files

Testsuite - Improve testsuite_user assuming it's NOT in Slurm DB


Improve testsuite_user docs.
Add a log_warn on check_run_as_user in case user is on DB.

Bug 9313

Signed-off-by: default avatarChad Vizino <chad@schedmd.com>
parent ca39b938
No related branches found
No related tags found
No related merge requests found
...@@ -42,8 +42,9 @@ testsuite_subtest_details: add details of subtest in the summary [fail] ...@@ -42,8 +42,9 @@ testsuite_subtest_details: add details of subtest in the summary [fail]
possible values: all, fail, fail_skip or none possible values: all, fail, fail_skip or none
testsuite_testproc_details: add details of testprocs in the summary [fail] testsuite_testproc_details: add details of testprocs in the summary [fail]
possible values: all, fail, fail_skip or none possible values: all, fail, fail_skip or none
testsuite_user: username that may be used when an admin user testsuite_user: a system username that is NOT on the Slurm DB
such as slurm or root is not desired that may be used to sudo commands as him
instead of current user (see check_run_as_user)
The testsuite needs at least one cluster-wide shared file system. The testsuite needs at least one cluster-wide shared file system.
By default, we assume that it's the testsuite/expect directory (i.e. "."). By default, we assume that it's the testsuite/expect directory (i.e. ".").
......
...@@ -808,6 +808,10 @@ proc tolerance { expected observed tolerance_expression } { ...@@ -808,6 +808,10 @@ proc tolerance { expected observed tolerance_expression } {
# check. Calling user should be permitted to run_commands as the # check. Calling user should be permitted to run_commands as the
# supplied user using sudo without password. # supplied user using sudo without password.
# See the -user option of run_command. # See the -user option of run_command.
# This proc also log_warn a message if user already exists in the DB
# because most probably this user is testsuite_user and that user is
# expected NOT to be in the DB and could potentially be removed from it by
# the test.
# #
# RETURN VALUE # RETURN VALUE
# Returns a boolean value indicating whether the calling user may # Returns a boolean value indicating whether the calling user may
...@@ -824,6 +828,11 @@ proc check_run_as_user user { ...@@ -824,6 +828,11 @@ proc check_run_as_user user {
if {[run_command_status -none -user $user "$bin_id -un"]} { if {[run_command_status -none -user $user "$bin_id -un"]} {
return false return false
} }
if {[get_admin_level $user] != ""} {
log_warn "User $user already exists in DB, but it's probable that it's going to be removed by the test cleanup"
}
return true return true
} }
...@@ -872,6 +881,7 @@ proc check_run_as_user user { ...@@ -872,6 +881,7 @@ proc check_run_as_user user {
# -user <user> # -user <user>
# Attempt to execute command as <user>. Note that sudo must be # Attempt to execute command as <user>. Note that sudo must be
# properly configured to permit the caller to execute as <user>. # properly configured to permit the caller to execute as <user>.
# See check_run_as_user.
# #
# ARGUMENTS # ARGUMENTS
# command # command
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment