diff --git a/testsuite/expect/test4.5 b/testsuite/expect/test4.5
index e2f0fd5ba55ace7df2048b91b136142274db57b3..92eeb6d934ef85c38ffb6f1e33aaae127071b69b 100755
--- a/testsuite/expect/test4.5
+++ b/testsuite/expect/test4.5
@@ -46,22 +46,18 @@ set mismatches   0
 set node_pos     2
 array set node_list {}
 
-proc change_state { state } {
+proc change_state { state nodes } {
+	global scontrol exit_code
 
-	global scontrol node_list node_pos exit_code
-
-	for {set i 0} {$i<2} {incr i 1} {
-		spawn $scontrol update nodename=$node_list($node_pos) state=$state reason=test
-		expect {
-			timeout {
-				send_user "\nFAILURE: scontrol is not responding\n"
-				set exit_code 1
-			}
-			eof {
-				wait
-			}
+	spawn $scontrol update nodename=$nodes state=$state reason=test
+	expect {
+		timeout {
+			send_user "\nFAILURE: scontrol is not responding\n"
+			set exit_code 1
+		}
+		eof {
+			wait
 		}
-		incr node_pos 1
 	}
 }
 
@@ -202,12 +198,16 @@ expect {
 
 cancel_job $tmp_id
 
+# Change nodes to different states and see if they made it to that state.
+
+change_state idle $node_list(2),$node_list(3)
+change_state down $node_list(4),$node_list(5)
+change_state drain $node_list(6),$node_list(7)
+
 #
 # Change node state to idle and use state filter to filter node
 #
 send_user "\nTesting IDLE state\n"
-change_state idle
-
 spawn $sinfo --Node --node=$node_list(2),$node_list(3) --long --exact --state=idle -p$partition
 expect {
 	-re "($end_of_line)($name_string) *($number_with_suffix) *($name_string) *($alpha)" {
@@ -237,7 +237,6 @@ expect {
 # Change node state to down and use state filter to filter node
 #
 send_user "\nTesting DOWN state\n"
-change_state down
 spawn $sinfo --Node --node=$node_list(4),$node_list(5) --long --exact --state=down -p$partition
 expect {
 	-re "($end_of_line)($name_string) *($number_with_suffix) *($name_string) *($alpha)" {
@@ -267,7 +266,6 @@ expect {
 # Change node state to drain and use state filter to filter node
 #
 send_user "\nTesting DRAIN state\n"
-change_state drain
 spawn $sinfo --Node --node=$node_list(6),$node_list(7) --long --exact --state=drain -p$partition
 expect {
 	-re "($end_of_line)($name_string) *($number_with_suffix) *($name_string) *($alpha)" {