diff --git a/testsuite/expect/test21.36 b/testsuite/expect/test21.36
index 4f64a07d0cf138140659b227f7a7f1dd094428dc..60a3310ee9b66fff0843e1f7a1291f3e8cda4ad1 100755
--- a/testsuite/expect/test21.36
+++ b/testsuite/expect/test21.36
@@ -52,17 +52,35 @@ set acct_req(cluster) $cluster
 set user_req(account) $account
 set user_req(cluster) $cluster
 
+exec $bin_rm -f $sql_query $sql_query_rem
+
+# DON'T MESS WITH THIS UNLESS YOU REALLY UNDERSTAND WHAT YOU ARE DOING!!!!!
+# THIS COULD SERIOUSLY MESS UP YOUR DATABASE IF YOU ALTER THIS INCORRECTLY
+# JUST A FRIENDLY REMINDER ;)
+
+# Insert a job that has no end time and is still in running state
+set file [open $sql_query "w"]
+puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, track_steps, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
+puts $file "('65536', '6', 'test21-36wckey', '1', '1002', '1002', 'debug', '', '$cluster', '$account', 1199170800, 1199170800, 1199170800, 0, '0', 'test21.32_job1', '0', '1', '0', '2', 2, '1=2', 'test21.36_node', '0', '0', '0')"
+puts $file "on duplicate key update id=LAST_INSERT_ID(id), eligible=VALUES(eligible), submit=VALUES(submit), start=VALUES(start), end=VALUES(end), associd=VALUES(associd), tres_alloc=VALUES(tres_alloc), wckey=VALUES(wckey), wckeyid=VALUES(wckeyid);"
+close $file
+
+# Make SQL file to remove the inserted job
+set file [open $sql_query_rem "w"]
+puts $file [format "%s%s%s" "truncate table \"" $cluster "_job_table\";"]
+close $file
+
 # Remove pre-existing items
 proc cleanup { } {
-	global cluster account user bin_rm sql_query sql_query_rem
-	remove_cluster "$cluster"
-	remove_acct "" $account
+	global cluster account user sql_query_rem
+	archive_load $sql_query_rem
 	remove_user "" "" $user
-	exec $bin_rm -f $sql_query $sql_query_rem
+	remove_acct "" $account
+	remove_cluster "$cluster"
 }
 
 proc endit { } {
-	global exit_code
+	global exit_code bin_rm sql_query sql_query_rem
 	cleanup
 
 	if {$exit_code == 0} {
@@ -71,6 +89,8 @@ proc endit { } {
 		send_user "\nFAILURE\n"
 	}
 
+	exec $bin_rm -f $sql_query $sql_query_rem
+
 	exit $exit_code
 }
 
@@ -85,22 +105,6 @@ if {[test_using_slurmdbd] == 0} {
 # Remove pre-existing items
 cleanup
 
-# DON'T MESS WITH THIS UNLESS YOU REALLY UNDERSTAND WHAT YOU ARE DOING!!!!!
-# THIS COULD SERIOUSLY MESS UP YOUR DATABASE IF YOU ALTER THIS INCORRECTLY
-# JUST A FRIENDLY REMINDER ;)
-
-# Insert a job that has no end time and is still in running state
-set file [open $sql_query "w"]
-puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, track_steps, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
-puts $file "('65536', '6', 'test21-36wckey', '1', '1002', '1002', 'debug', '', '$cluster', '$account', 1199170800, 1199170800, 1199170800, 0, '0', 'test21.32_job1', '0', '1', '0', '2', 2, '1=2', 'test21.36_node', '0', '0', '0')"
-puts $file "on duplicate key update id=LAST_INSERT_ID(id), eligible=VALUES(eligible), submit=VALUES(submit), start=VALUES(start), end=VALUES(end), associd=VALUES(associd), tres_alloc=VALUES(tres_alloc), wckey=VALUES(wckey), wckeyid=VALUES(wckeyid);"
-close $file
-
-# Make SQL file to remove the inserted job
-set file [open $sql_query_rem "w"]
-puts $file [format "%s%s%s" "truncate table \"" $cluster "_job_table\";"]
-close $file
-
 # Add Test Cluster
 if {[add_cluster $cluster [array get clus_req]]} {
 	endit