Skip to content
Snippets Groups Projects
Commit cff26c6f authored by Joseph P. Donaghy's avatar Joseph P. Donaghy
Browse files

Test to modify a user.

parent 4e4cfb04
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# sacctmgr modify a user
#
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR
# anything else indicates a failure mode that must be investigated.
############################################################################
# Copyright (C) 2008 Lawrence Livermore National Security.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Joseph Donaghy <donaghy1@llnl.gov>
# LLNL-CODE-402394.
#
# This file is part of SLURM, a resource management program.
# For details, see <http://www.llnl.gov/linux/slurm/>.
#
# SLURM is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with SLURM; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
############################################################################
source ./globals
set test_id "21.17"
set exit_code 0
set acmatches 0
set aamatches 0
set aa2matches 0
set lmatches 0
set damatches 0
set dcmatches 0
set dumatches 0
set dlumatches 0
set not_support 0
set add add
set lis list
set del delete
set mod modify
set nams Names
set nam Name
set fs Fairshare
set mc MaxCPUSecs
set mj MaxJobs
set mn MaxNodes
set mw MaxWall
set clu cluster
set tc1 tclus1
set tc2 tclus2
set tc3 tclus3
set fs1 2500
set fs2 1200
set mc1 1000000
set mc2 200000
set mj1 100
set mj2 50
set mn1 300
set mn2 200
set mw1 01:00:00
set mw2 02:00:00
set acc account
set acs accounts
set ass associations
set nm1 tacct1
set nm2 tacct2
set des Description
set ds1 "onestestAccount"
set ds2 "testaccount2"
set org Organization
set or1 "oneaccountOrg"
set or2 "acctorg2"
set qs QosLevel
set qs1 normal
set usr user
set us1 tuser1
set us2 tuser2
set al AdminLevel
set aln None
set ala Admin
set alo Operator
set dac DefaultAccount
set par Partitions
set dbu debug
print_header $test_id
#
# Use sacctmgr to create a cluster
#
set sadd_pid [spawn $sacctmgr -i add $clu $nams=$tc1,$tc2,$tc3 $fs=$fs1 $mc=$mc1 $mj=$mj1 $mn=$mn1 $mw=$mw1]
expect {
-re "Adding Cluster" {
incr acmatches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr add not responding\n"
slow_kill $sadd_pid
set exit_code 1
}
eof {
wait
}
}
if {$acmatches != 1} {
send_user "\nFAILURE: sacctmgr had a problem adding clusters
got $acmatches\n"
set exit_code 1
}
if { ![check_acct_associations] } {
send_user "\nFAILURE: Our associations don't line up\n"
set exit_code 1
}
#
# Use sacctmgr to add test accounts
#
set sadel_pid [spawn $sacctmgr -i $add $acc $clu=$tc1,$tc2,$tc3 $des="$ds1" $fs=$fs1 $mc=$mc1 $mj=$mj1 $mn=$mn1 $mw=$mw1 $nams=$nm1 $org="$or1" $qs=$qs1]
expect {
-re "Adding Account" {
incr aamatches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr add not responding\n"
slow_kill $sadd_pid
set exit_code 1
}
eof {
wait
}
}
if {$aamatches != 1} {
send_user "\nFAILURE: sacctmgr had a problem adding account.
got $aamatches\n"
set exit_code 1
}
#
# Use sacctmgr to add a second account
#
set sadel_pid [spawn $sacctmgr -i $add $acc $clu=$tc1,$tc2,$tc3 $des=$ds2 $fs=$fs2 $mc=$mc2 $mj=$mj2 $mn=$mn2 $mw=$mw2 $nams=$nm2 $org=$or2 $qs=$qs1]
expect {
-re "Adding Account" {
incr aa2matches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr add not responding\n"
slow_kill $sadd_pid
set exit_code 1
}
eof {
wait
}
}
if {$aa2matches != 1} {
send_user "\nFAILURE: sacctmgr had a problem adding account.
got $aamatches\n"
set exit_code 1
}
#
# Use sacctmgr to add a user
#
set as_list_pid [spawn $sacctmgr -i $add $usr $acs=$nm1 $al=$alo $clu=$tc1,$tc2 $dac=$nm2 $fs=$fs2 $mc=$mc2 $mj=$mj2 $mn=$mn2 $mw=$mw2 $nams=$us1,$us2 $par=$dbu $qs=$qs1 ]
expect {
-re "$nams *$nm1" {
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr list associations not responding\n"
slow_kill $as_list_pid
set exit_code 1
}
eof {
wait
}
}
if { ![check_acct_associations] } {
send_user "\nFAILURE: Our associations don't line up\n"
set exit_code 1
}
#
# Use sacctmgr to list the test user
#
set as_list_pid [spawn $sacctmgr list $usr $nams=$us1,$us2 WithAssocs]
expect {
-re "$us1" {
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr list user not responding\n"
slow_kill $as_list_pid
set exit_code 1
}
eof {
wait
}
}
#
# Use sacctmgr to modify user
#
set as_list_pid [spawn $sacctmgr -i $mod $usr set $al=$ala $dac=$nm1 $fs=$fs1 $mc=$mc1 $mj=$mj1 $mn=$mn1 $mw=$mw1 $qs=$qs1 where $acs=$nm2 $al=$alo $clu=$tc2 $dac=$nm2 $nams=$us2 $par=$dbu $qs=$qs1 ]
expect {
-re "$nams *$nm2" {
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr list associations not responding\n"
slow_kill $as_list_pid
set exit_code 1
}
eof {
wait
}
}
if { ![check_acct_associations] } {
send_user "\nFAILURE: Our associations don't line up\n"
set exit_code 1
}
#
# Use sacctmgr to list the test user
#
set as_list_pid [spawn $sacctmgr list $usr $nams=$us1,$us2 WithAssocs]
expect {
-re "$us1 *$nm2 *$qs1 *$alo *$tc1 *$nm2 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us1 *$nm2 *$qs1 *$alo *$tc1 *$nm1 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us1 *$nm2 *$qs1 *$alo *$tc2 *$nm2 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us1 *$nm2 *$qs1 *$alo *$tc2 *$nm1 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us2 *$nm1 *$qs1 *$ala.* *$tc1 *$nm2 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us2 *$nm1 *$qs1 *$ala.* *$tc1 *$nm1 *$dbu *$fs2 *$mc2 *$mj2 *$mn2 *$mw2" {
incr dlumatches
exp_continue
}
-re "$us2 *$nm1 *$qs1 *$ala.* *$tc2 *$nm2 *$dbu *$fs1 *$mc1 *$mj1 *$mn1 *$mw1" {
incr dlumatches
exp_continue
}
-re "$us2 *$nm1 *$qs1 *$ala.* *$tc2 *$nm1 *$dbu *$fs1 *$mc1 *$mj1 *$mn1 *$mw1" {
incr dlumatches
exp_continue
}
-re "$tc3" {
send_user "\nFAILURE: $tc3 found but not expected\n"
set exit_code 1
}
timeout {
send_user "\nFAILURE: sacctmgr list user not responding\n"
slow_kill $as_list_pid
set exit_code 1
}
eof {
wait
}
}
if {$dlumatches != 8} {
send_user "\nFAILURE: sacctmgr had a problem listing user got $dumatches\n"
set exit_code 1
}
#
# Use sacctmgr to delete the test user
#
set sadel_pid [spawn $sacctmgr -i $del $usr $us1,$us2]
expect {
-re "Deleting users" {
incr dumatches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr delete not responding\n"
slow_kill $sadel_pid
set exit_code 1
}
eof {
wait
}
}
if {$dumatches != 1} {
send_user "\nFAILURE: sacctmgr had a problem deleting user got $dumatches\n"
set exit_code 1
}
#
# Use sacctmgr to delete the test account
#
set sadel_pid [spawn $sacctmgr -i $del $acc $nm1,$nm2]
expect {
-re "Deleting account" {
incr damatches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr delete not responding\n"
slow_kill $sadel_pid
set exit_code 1
}
eof {
wait
}
}
if {$damatches != 1} {
send_user "\nFAILURE: sacctmgr had a problem deleting account got $damatches\n"
set exit_code 1
}
if { ![check_acct_associations] } {
send_user "\nFAILURE: Our associations don't line up\n"
set exit_code 1
}
#
# Use sacctmgr to delete the test cluster
#
set sadel_pid [spawn $sacctmgr -i $del $clu $tc1,$tc2,$tc3]
expect {
-re "Deleting clusters" {
incr dcmatches
exp_continue
}
timeout {
send_user "\nFAILURE: sacctmgr delete not responding\n"
slow_kill $sadel_pid
set exit_code 1
}
eof {
wait
}
}
if {$dcmatches != 1} {
send_user "\nFAILURE: sacctmgr had a problem deleting cluster got $dcmatches\n"
set exit_code 1
}
if { ![check_acct_associations] } {
send_user "\nFAILURE: Our associations don't line up\n"
set exit_code 1
}
if {$exit_code == 0} {
send_user "\nSUCCESS\n"
} else {
send_user "\nFAILURE\n"
}
exit $exit_code
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