Skip to content

Commit

Permalink
t: add test for querying cores-per-node info
Browse files Browse the repository at this point in the history
Problem: flux-accounting has no tests for estimating the cores-per-node
count by fetching resource.R from the KVS and then querying it from the
plugin.

Add some basic tests.
  • Loading branch information
cmoussa1 committed Jul 18, 2024
1 parent 57d46ca commit 5747337
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ TESTSCRIPTS = \
t1033-mf-priority-update-job.t \
t1034-mf-priority-config.t \
t1035-flux-account-scrub-old-jobs.t \
t1036-mf-priority-resource-counting.t \
t5000-valgrind.t \
python/t1000-example.py \
python/t1001_db.py \
Expand Down
31 changes: 31 additions & 0 deletions t/t1036-mf-priority-resource-counting.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

test_description='test calculating and storing system core information in priority plugin'

. `dirname $0`/sharness.sh

mkdir -p conf.d

MULTI_FACTOR_PRIORITY=${FLUX_BUILD_DIR}/src/plugins/.libs/mf_priority.so

export TEST_UNDER_FLUX_SCHED_SIMPLE_MODE="limited=1"
test_under_flux 4 job -o,--config-path=$(pwd)/conf.d

flux setattr log-stderr-level 1

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'

test_expect_success 'check that mf_priority plugin is loaded' '
flux jobtap list | grep mf_priority
'

test_expect_success 'check that cores-per-node count is correct' '
flux jobtap query mf_priority.so > query.json &&
test_debug "jq -S . <query.json" &&
flux resource R --include=0 | flux R decode --count=core > ncores_per_node.test &&
jq -e ".ncores_per_node == $(cat ncores_per_node.test)" <query.json
'

test_done

0 comments on commit 5747337

Please sign in to comment.