From b73886602f2d2c7cdaf5bf88ae74b608f6d4779f Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Mon, 2 Nov 2015 15:13:40 -0800 Subject: [PATCH] Improve test to test against multiple jobs started in one hour. Before if this was the case we could get bug 2068 http://bugs.schedmd.com/show_bug.cgi?id=2068 to happen. This will be fixed in a future commit. --- testsuite/expect/inc22.1.1 | 4 ++-- testsuite/expect/inc22.1.3 | 4 ++-- testsuite/expect/test22.1 | 16 +++++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/testsuite/expect/inc22.1.1 b/testsuite/expect/inc22.1.1 index 050c2c16f21..58a86a099a3 100644 --- a/testsuite/expect/inc22.1.1 +++ b/testsuite/expect/inc22.1.1 @@ -37,7 +37,7 @@ proc inc22_1_1 {} { - global account1 accounts users cluster_cpus job1_start user1 + global account1 accounts users cluster_cpus job0_start user1 global node0_down_start node0_cpus node1_cpus cluster sreport global exit_code wc_key_track wckey1 sql_rem @@ -53,7 +53,7 @@ proc inc22_1_1 {} { set end_str [timestamp -format %Y-%m-%dT%X -seconds $period_end] set reported [expr ($period_end - $period_start) * $cluster_cpus] set down [expr ($period_end-$node0_down_start) * $node0_cpus] - set alloc_sec [expr ($period_end-$job1_start) * $node1_cpus] + set alloc_sec [expr ($period_end-$job0_start) * $node1_cpus] set wckey_alloc_sec $alloc_sec set resv 0 set idle [expr $reported - ($down + $alloc_sec + $resv)] diff --git a/testsuite/expect/inc22.1.3 b/testsuite/expect/inc22.1.3 index 0b9740a9fc8..66ffb452b4e 100644 --- a/testsuite/expect/inc22.1.3 +++ b/testsuite/expect/inc22.1.3 @@ -39,7 +39,7 @@ proc inc22_1_3 { } { global sreport exit_code node0_down_start node0_down_end node0_cpus global node1_cpus cluster my_pid accounts users cluster_cpus - global job1_start job1_end job1_cpus job1_alloc job2_start + global job0_start job1_end job1_cpus job1_alloc job2_start global job2_end job2_cpus job2_alloc job2_elig job3_start global job3_end job3_cpus job3_alloc job3_elig acct1_alloc acct2_alloc global acct3_alloc total_alloc wckey1_alloc user1_wckey1_alloc @@ -59,7 +59,7 @@ proc inc22_1_3 { } { set reported [expr ($period_end - $period_start) * $cluster_cpus] set down [expr ($node0_down_end - $node0_down_start) * $node0_cpus] - set alloc_sec [expr ($job1_end-$job1_start) * $job1_cpus] + set alloc_sec [expr ($job1_end-$job0_start) * $job1_cpus] set alloc_sec [expr $alloc_sec + (($job2_end-$job2_start) * $job2_cpus)] set alloc_sec [expr $alloc_sec + (($job3_end-$job3_start) * $job3_cpus)] set wckey_alloc_sec1 [expr $job1_alloc + $job3_alloc] diff --git a/testsuite/expect/test22.1 b/testsuite/expect/test22.1 index 1d30b6567ec..652500daa39 100755 --- a/testsuite/expect/test22.1 +++ b/testsuite/expect/test22.1 @@ -102,17 +102,21 @@ set period_end [exec date -d $end_date +%s] set start_str [timestamp -format %Y-%m-%dT%X -seconds $period_start] set end_str [timestamp -format %Y-%m-%dT%X -seconds $period_end] +#job0 - we really want this to look like job1 but run right before hand. +set job0_start $period_start +set job0_run 1200 +set job0_end [expr $job0_start + $job0_run] #job1 -set job1_start $period_start -set job1_run 3900 -set job1_end [expr $job1_start+$job1_run] +set job1_start [expr $period_start + 1200] +set job1_run 2700 +set job1_end [expr $job1_start + $job1_run] # This will give us the correct time we ran for set job1_diff_str [timestamp -format %X -seconds [expr $midnight+$job1_run]] set job1_start_str [timestamp -format %Y-%m-%dT%X -seconds $job1_start] set job1_end_str [timestamp -format %Y-%m-%dT%X -seconds $job1_end] set job1_nodes $node1 set job1_cpus $node1_cpus -set job1_alloc [expr $job1_run * $job1_cpus] +set job1_alloc [expr ($job1_run + $job0_run) * $job1_cpus] set job1_acct $account1 #job2 @@ -141,7 +145,8 @@ set job3_start $job2_end set job3_run 3900 set job3_end [expr $job3_start+$job3_run] # This will give us the correct time we ran for -set job3_diff_str [timestamp -format %X -seconds [expr $midnight+$job1_run]] +set job3_diff_str [timestamp -format %X -seconds [expr $midnight+$job3_run]] + set job3_start_str [timestamp -format %Y-%m-%dT%X -seconds $job3_start] set job3_end_str [timestamp -format %Y-%m-%dT%X -seconds $job3_end] #run on just node0 @@ -331,6 +336,7 @@ puts $file "on duplicate key update period_start=VALUES(period_start), period_en #now we will put in a job running for an hour and 5 minutes 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', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job0_start, $job0_start, $job0_start, $job0_end, '0', 'test_job1', '0', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')" puts $file "('65537', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job1_start, $job1_start, $job1_start, $job1_end, '0', 'test_job1', '0', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')" puts $file ", ('65538', '$user2acct3', '$wckey1', '$user2wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job2_acct', $job2_elig, $job2_elig, $job2_start, $job2_end, '0', 'test_job2', '0', '3', '0', '$job2_cpus', '$job2_cpus', '1=$job2_cpus', '$job2_nodes', '0', '0', '0')" puts $file ", ('65539', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job3_acct', $job3_elig, $job3_elig, $job3_start, $job3_end, '0', 'test_job3', '0', '3', '0', '$job3_cpus', '$job3_cpus', '1=$job3_cpus', '$job3_nodes', '0', '0', '0')" -- GitLab