From 80adaf50e9b492ed79ca56c14fa5786376cac074 Mon Sep 17 00:00:00 2001
From: Brian Christiansen <brian@schedmd.com>
Date: Tue, 4 Apr 2017 17:34:06 -0600
Subject: [PATCH] Fix fed tests to look at local jobs

The fed tests are checking the state of each sibling on each cluster.
Since squeue/scontrol now combine the jobs from all clusters into one,
the tests need to be update to look at state of the specific cluster.
---
 testsuite/expect/globals_federation | 2 +-
 testsuite/expect/test37.4           | 4 ++--
 testsuite/expect/test37.5           | 8 ++++----
 testsuite/expect/test37.6           | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/testsuite/expect/globals_federation b/testsuite/expect/globals_federation
index ea6415440d8..8980111a96e 100644
--- a/testsuite/expect/globals_federation
+++ b/testsuite/expect/globals_federation
@@ -492,7 +492,7 @@ proc wait_for_fed_job { job_id desired_state clusters } {
 	while 1 {
 		foreach cluster $spec_clusters {
 			log_info "checking $cluster"
-			set fd [open "|$scontrol -M$cluster -a -o show job $job_id"]
+			set fd [open "|$scontrol -M$cluster --local -a -o show job $job_id"]
 			gets $fd line
 			catch {close $fd}
 			if {[regexp {JobState\s*=\s*(\w+)} $line foo state] != 1} {
diff --git a/testsuite/expect/test37.4 b/testsuite/expect/test37.4
index 5d3d362c4da..73bf56b79d4 100755
--- a/testsuite/expect/test37.4
+++ b/testsuite/expect/test37.4
@@ -268,7 +268,7 @@ proc validate_fed_job { cname job_id expected_origin expected_sib submit_cluster
 	if {$submit_cluster ne ""} {
 		set my_squeue "${fed_slurm_base}/$submit_cluster/bin/squeue"
 	}
-	spawn $my_squeue --jobs=$job_id --noheader -Oorigin,siblingsactive -a
+	spawn $my_squeue -a --local --jobs=$job_id --noheader -Oorigin,siblingsactive
 	expect {
 		-re "(\\S+)\\s+(\\S+)" {
 			set origin  $expect_out(1,string)
@@ -295,7 +295,7 @@ proc validate_fed_job { cname job_id expected_origin expected_sib submit_cluster
 			continue
 		}
 		set my_squeue "${fed_slurm_base}/$tmp_sib/bin/squeue"
-		spawn $my_squeue --jobs=$job_id --noheader -Oorigin,siblingsactive
+		spawn $my_squeue -a --local --jobs=$job_id --noheader -Oorigin,siblingsactive
 		set match 0
 		expect {
 			-re "(\\S+)\\s+(\\S+)" {
diff --git a/testsuite/expect/test37.5 b/testsuite/expect/test37.5
index 9e7cea4aeb3..dd4928308a0 100755
--- a/testsuite/expect/test37.5
+++ b/testsuite/expect/test37.5
@@ -122,7 +122,7 @@ proc check_ctl_state { job_id state cluster } {
 	global scontrol
 
 	set job_state 0
-	spawn $scontrol -M$cluster show job $job_id -a
+	spawn $scontrol -M$cluster -a --local show job $job_id
 	expect {
 		-re "JobState=$state" {
 			set job_state 1
@@ -147,7 +147,7 @@ proc check_missing_job { job_id cluster } {
 	global scontrol
 
 	set matched 0
-	spawn $scontrol -M$cluster show job $job_id -a
+	spawn $scontrol -M$cluster -a --local show job $job_id
 	expect {
 		"slurm_load_jobs error: Invalid job id specified" {
 			set matched 1
@@ -268,7 +268,7 @@ proc check_hold { job } {
 	global scontrol number exit_code
 
 	set matches 0
-	spawn $scontrol show job $job
+	spawn $scontrol -a --local show job $job
 	expect {
 		"Priority=0" {
 			incr matches
@@ -298,7 +298,7 @@ proc check_exit_hold { job } {
 	global scontrol number exit_code
 
 	set matches 0
-	spawn $scontrol show job $job
+	spawn $scontrol -a --local show job $job
 	expect {
 		"Priority=0" {
 			incr matches
diff --git a/testsuite/expect/test37.6 b/testsuite/expect/test37.6
index 8c01d4dbfae..a8c4a2b24ad 100755
--- a/testsuite/expect/test37.6
+++ b/testsuite/expect/test37.6
@@ -162,7 +162,7 @@ proc verify {fed job_id pattern error_message} {
 
 	set matches 0
 	set my_squeue "${fed_slurm_base}/$fed/bin/squeue"
-	spawn $my_squeue -j $job_id --noheader \
+	spawn $my_squeue -a --local -j $job_id --noheader \
 		-Ostatecompact:.5,siblingsviable:.20,siblingsactive:.20
 	expect {
 		-re "\\s+$pattern" {
-- 
GitLab