From 9e4ce8b81f7f70cf9b807ab93147938adc065dab Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Thu, 7 Jan 2016 13:38:39 -0800
Subject: [PATCH] Modify test for partition limits enforcement changes

The slurmctld behaviour has changed slightly with respect to EnforcePartLimits
  supporting new options of ANY and ALL, which broke  2 tests. This change
  modifies the tests to only run on appropriate configurations.
---
 testsuite/expect/globals   | 29 +++++++++++++++++++++++++++++
 testsuite/expect/test17.21 |  6 ++++++
 testsuite/expect/test17.28 |  6 ++++++
 3 files changed, 41 insertions(+)

diff --git a/testsuite/expect/globals b/testsuite/expect/globals
index 9bde0adc87e..48ba6d32a32 100755
--- a/testsuite/expect/globals
+++ b/testsuite/expect/globals
@@ -884,6 +884,35 @@ proc test_limits_enforced { } {
 	return $enforced
 }
 
+################################################################
+#
+# Proc: test_enforce_part_limits
+#
+# Purpose: Return value of EnforcePartLimits
+#
+# Returns EnforcePartLimits value (ALL, ANY, or NO)
+#
+################################################################
+proc test_enforce_part_limits { } {
+	global alpha scontrol
+
+	log_user 0
+	set enforced "UNKNOWN"
+	spawn $scontrol show config
+	expect {
+		-re "EnforcePartLimits *= ($alpha)" {
+			set enforced $expect_out(1,string)
+			exp_continue
+		}
+		eof {
+			wait
+		}
+	}
+
+	log_user 1
+	return $enforced
+}
+
 ################################################################
 #
 # Proc: test_gang
diff --git a/testsuite/expect/test17.21 b/testsuite/expect/test17.21
index 454a1ee3ed5..4a97e843e32 100755
--- a/testsuite/expect/test17.21
+++ b/testsuite/expect/test17.21
@@ -42,6 +42,12 @@ set delay       10
 
 print_header $test_id
 
+set enforce [test_enforce_part_limits]
+if {![string compare $enforce "NO"]} {
+	send_user "\nWARNING: This test is incompatible EnforcePartLimits = $enforce\n"
+	exit 0
+}
+
 make_bash_script $file_in "
 #SBATCH --job-name='$job_name'
 $bin_sleep $delay
diff --git a/testsuite/expect/test17.28 b/testsuite/expect/test17.28
index 9dabf7abe8e..f1d6c624e3c 100755
--- a/testsuite/expect/test17.28
+++ b/testsuite/expect/test17.28
@@ -42,6 +42,12 @@ set delay       1
 
 print_header $test_id
 
+set enforce [test_enforce_part_limits]
+if {![string compare $enforce "NO"]} {
+	send_user "\nWARNING: This test is incompatible EnforcePartLimits = $enforce\n"
+	exit 0
+}
+
 make_bash_script $file_in "
 #SBATCH --job-name=$job_name
 $bin_sleep $delay
-- 
GitLab