Skip to content

Commit

Permalink
t: add simple test for flux-simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
SteVwonder committed Nov 27, 2019
1 parent 1205eff commit ac28a43
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
11 changes: 11 additions & 0 deletions t/simulator/job-traces/10-multi-node.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
JobID,NNodes,NCPUS,Timelimit,Submit,Elapsed
1,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
2,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
3,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
4,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
5,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
6,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
7,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
8,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
9,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
10,10,160,00:10:00,2019-01-01T00:00:00,00:06:00
11 changes: 11 additions & 0 deletions t/simulator/job-traces/10-single-node.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
JobID,NNodes,NCPUS,Timelimit,Submit,Elapsed
1,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
2,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
3,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
4,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
5,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
6,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
7,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
8,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
9,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
10,1,16,00:10:00,2019-01-01T00:00:00,00:06:00
36 changes: 36 additions & 0 deletions t/t9000-simulation.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

test_description='Test flux simulator command'

. $(dirname $0)/sharness.sh

test_under_flux 1

# Set CLIMain log level to logging.DEBUG (10), to enable stack traces
export FLUX_PYCLI_LOGLEVEL=10

flux setattr log-stderr-level 1

SIM_JOBTRACES_DIR=${SHARNESS_TEST_SRCDIR}/simulator/job-traces

test_expect_success 'flux simulator fails with usage message' '
test_must_fail flux simulator 2>usage.err &&
grep -i usage: usage.err
'

test_expect_success 'flux simulator with single node works' '
flux simulator $SIM_JOBTRACES_DIR/10-single-node.csv 1 16 >run1.out &&
grep -i "utilization: 100" run1.out
'

test_expect_success 'flux simulator with multiple nodes works' '
flux simulator $SIM_JOBTRACES_DIR/10-single-node.csv 3 16 >run2.out &&
grep -i "utilization: 83" run2.out
'

test_expect_failure 'flux simulator errors out on unstaisfiable jobs' '
run_timeout 5 flux simulator $SIM_JOBTRACES_DIR/10-multi-node.csv 1 16 >run3.out 2>run3.err &&
grep -i "unsatisfiable" run3.err
'

test_done

0 comments on commit ac28a43

Please sign in to comment.