diff --git a/testsuite/expect/test1.7 b/testsuite/expect/test1.7
index 489c43c42f6a0d972c5ea50d1b4410ab6a015c92..ddeca4d7cff806715e548d53f3e58013837acd01 100755
--- a/testsuite/expect/test1.7
+++ b/testsuite/expect/test1.7
@@ -10,7 +10,7 @@
 # Note:    This script generates and then deletes files in the working directory 
 #          named test1.7.input, test1.7.output, and test1.7.error
 ############################################################################
-# Copyright (C) 2002 The Regents of the University of California.
+# Copyright (C) 2002-6 The Regents of the University of California.
 # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 # Written by Morris Jette <jette1@llnl.gov>
 # UCRL-CODE-217948.
@@ -41,11 +41,37 @@ set file_out    "test$test_id.output"
 set file_err    "test$test_id.error"
 set job_id      0
 
-# NOTE: If you change sleep_time, change job time limits as well
+# NOTE: If you increase sleep_time, change job time limits as well
 set sleep_time  180
 
 print_header $test_id
 
+#
+# Make sure sleep time is no larger than InactiveLimit
+set inactive_limit  $sleep_time
+log_user 0
+spawn $scontrol show config
+expect {
+	-re "InactiveLimit.*= ($number)" {
+		set inactive_limit $expect_out(1,string)
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: scontrol not responding\n"
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+log_user 1
+if {$inactive_limit < $sleep_time} {
+	if {$inactive_limit != 0} {
+		set sleep_time $inactive_limit
+		send_user "\nReset job sleep time to $sleep_time seconds\n"
+	}
+}
+
 #
 # Delete left-over input script plus stdout/err files
 # Build input script file