Skip to content

Commit

Permalink
t/flux-jobspec: test that valid jobspec is created
Browse files Browse the repository at this point in the history
  • Loading branch information
SteVwonder committed Feb 6, 2019
1 parent dc57b7a commit 5ba92b8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/Makefile.am
Expand Up @@ -61,6 +61,7 @@ TESTS = \
t0017-security.t \
t0019-jobspec-schema.t \
t0020-emit-jobspec.t \
t0021-flux-jobspec.t \
t1000-kvs.t \
t1001-kvs-internals.t \
t1002-kvs-watch.t \
Expand Down Expand Up @@ -174,6 +175,7 @@ check_SCRIPTS = \
t0017-security.t \
t0019-jobspec-schema.t \
t0020-emit-jobspec.t \
t0021-flux-jobspec.t \
t1000-kvs.t \
t1001-kvs-internals.t \
t1002-kvs-watch.t \
Expand Down
59 changes: 59 additions & 0 deletions t/t0021-flux-jobspec.t
@@ -0,0 +1,59 @@
#!/bin/sh

test_description='Test the flux-jobspec command'

. `dirname $0`/sharness.sh

JOBSPEC=${SHARNESS_TEST_SRCDIR}/jobspec
VALIDATE=${JOBSPEC}/validate.py
SCHEMA=${FLUX_SOURCE_DIR}/src/modules/job-ingest/schemas/jobspec.jsonschema
MINI_SCHEMA=${JOBSPEC}/minimal-schema.json

validate_emission() {
flux jobspec $@ | ${VALIDATE} --schema ${SCHEMA}
}

validate_minimal_emission() {
flux jobspec $@ | ${VALIDATE} --schema ${MINI_SCHEMA}
}

test_expect_success 'flux-jobspec srun with no args emits valid canonical jobspec' '
validate_emission srun sleep 1
'

test_expect_success 'flux-jobspec srun with no args emits minimal jobspec' '
validate_minimal_emission srun sleep 1
'

test_expect_success 'flux-jobspec srun with just num_tasks emits valid canonical jobspec' '
validate_emission srun -n4 sleep 1
'

test_expect_success 'flux-jobspec srun with just num_tasks emits minimal jobspec' '
validate_minimal_emission srun -n4 sleep 1
'

test_expect_success 'flux-jobspec srun with just cores_per_task emits valid canonical jobspec' '
validate_emission srun -c4 sleep 1
'

test_expect_success 'flux-jobspec srun with just cores_per_task emits minimal jobspec' '
validate_minimal_emission srun -c4 sleep 1
'

test_expect_success 'flux-jobspec srun without num_nodes emits valid canonical jobspec' '
validate_emission srun -n4 -c1 sleep 1
'

test_expect_success 'flux-jobspec srun without num_nodes emits minimal jobspec' '
validate_minimal_emission srun -n4 -c1 sleep 1
'

test_expect_success 'flux-jobspec srun with all args emits valid canonical jobspec' '
validate_emission srun -N4 -n4 -c1 sleep 1
'

test_expect_success 'flux-jobspec srun with all args emits minimal jobspec' '
validate_minimal_emission srun -N4 -n4 -c1 sleep 1
'
test_done

0 comments on commit 5ba92b8

Please sign in to comment.