From 1b72bf4f110342db26c4f7f71a193d53b67ded4c Mon Sep 17 00:00:00 2001
From: Marshall Garey <marshall@schedmd.com>
Date: Tue, 27 Mar 2018 15:11:58 -0600
Subject: [PATCH] testsuite - add global 'reconfigure' function

Bug 4926.
---
 testsuite/expect/globals | 45 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/testsuite/expect/globals b/testsuite/expect/globals
index 8a053a6863f..6f86ec19dcc 100755
--- a/testsuite/expect/globals
+++ b/testsuite/expect/globals
@@ -4237,6 +4237,51 @@ proc test_pack_step { } {
 	return $pack_step
 }
 
+################################################################
+#
+# Proc: reconfigure
+#
+# Purpose:	Calls scontrol reconfigure.
+#
+# Input (optional) cluster 	- The cluster to reconfigure.
+# Output global exit_code 	- Sets exit_code to 1 on failure.
+#
+# Returns void
+#
+################################################################
+proc reconfigure { {cluster ""} } {
+	global exit_code scontrol
+
+	if { $cluster == "" } {
+		spawn $scontrol reconfigure
+	} else {
+		spawn $scontrol -M$cluster reconfigure
+	}
+	expect {
+		-re "slurm_reconfigure error: Invalid user id" {
+			log_error "Invalid user id"
+			set exit_code 1
+			exp_continue
+		}
+		-re "Error|error" {
+			log_error "scontrol reconfigure error"
+			set exit_code 1
+			exp_continue
+		}
+		timeout {
+			log_error "scontrol not responding\n"
+			set exit_code 1
+		}
+		eof {
+			wait
+		}
+	}
+	#
+	# Wait for reconfigure to complete, then return.
+	#
+	sleep 5
+}
+
 proc log_error {msg} {
 	send_user "\nFAILURE: $msg\n"
 }
-- 
GitLab