-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
t: add tests for calling view-user --list-banks
Problem: There exists no tests for calling view-user with the --list-banks option. Add some tests.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
test_description='test calling view-user with the --list-banks optional argument' | ||
|
||
. `dirname $0`/sharness.sh | ||
|
||
mkdir -p conf.d | ||
|
||
MULTI_FACTOR_PRIORITY=${FLUX_BUILD_DIR}/src/plugins/.libs/mf_priority.so | ||
SUBMIT_AS=${SHARNESS_TEST_SRCDIR}/scripts/submit_as.py | ||
ACCOUNTING_DB=$(pwd)/FluxAccountingTest.db | ||
|
||
export TEST_UNDER_FLUX_SCHED_SIMPLE_MODE="limited=1" | ||
test_under_flux 1 job -o,--config-path=$(pwd)/conf.d | ||
|
||
flux setattr log-stderr-level 1 | ||
|
||
|
||
test_expect_success 'create flux-accounting DB, start flux-accounting service' ' | ||
flux account -p ${ACCOUNTING_DB} create-db && | ||
flux account-service -p ${ACCOUNTING_DB} -t | ||
' | ||
|
||
test_expect_success 'add some banks' ' | ||
flux account add-bank root 1 && | ||
flux account add-bank --parent-bank=root bankA 1 && | ||
flux account add-bank --parent-bank=root bankB 1 && | ||
flux account add-bank --parent-bank=root bankC 1 | ||
' | ||
|
||
test_expect_success 'add a user' ' | ||
flux account add-user --username=testuser --bank=bankA && | ||
flux account add-user --username=testuser --bank=bankB && | ||
flux account add-user --username=testuser --bank=bankC | ||
' | ||
|
||
test_expect_success 'call view-banks --list-banks' ' | ||
flux account view-user testuser --list-banks > list_banks.out && | ||
grep -E "bankA|bankB|bankC" list_banks.out | ||
' | ||
|
||
test_expect_success 'shut down flux-accounting service' ' | ||
flux python -c "import flux; flux.Flux().rpc(\"accounting.shutdown_service\").get()" | ||
' | ||
|
||
test_expect_success 'remove flux-accounting DB' ' | ||
rm ${ACCOUNTING_DB} | ||
' | ||
|
||
test_done |