From 4a18a1efb88eb2b8551a7f45423a07d221d1a64e Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Fri, 17 Jan 2025 16:30:52 -0800 Subject: [PATCH] t: move some tests towards end of tests Problem: The testing of stats clearing in the KVS is done a little bit before the end of a set of tests. This can be inconvenient for future tests that do not wish stats to be cleared. Move the clearing of stats tests towards the end of tests in t1001-kvs-internals.t. --- src/modules/kvs/kvs.c | 2 +- t/t1001-kvs-internals.t | 60 ++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/modules/kvs/kvs.c b/src/modules/kvs/kvs.c index a55c7b8b0709..4cd5043d6552 100644 --- a/src/modules/kvs/kvs.c +++ b/src/modules/kvs/kvs.c @@ -2448,7 +2448,7 @@ static void stats_get_cb (flux_t *h, "{ s:O s:O s:{s:O s:O} s:i }", "cache", cstats, "namespace", nsstats, - "transactions", + "transaction-opcount", "commit", txncstats, "fence", txnfstats, "pending_requests", zhashx_size (ctx->requests)) < 0) diff --git a/t/t1001-kvs-internals.t b/t/t1001-kvs-internals.t index ec113a52f9e6..525edcef784f 100755 --- a/t/t1001-kvs-internals.t +++ b/t/t1001-kvs-internals.t @@ -461,36 +461,6 @@ test_expect_success 'kvs: read-your-writes consistency on alt namespace' ' flux kvs namespace remove rywtestns ' -# -# test clear of stats -# - -# each store of largeval will increase the noop store count, b/c we -# know that the identical large value will be cached as raw data - -test_expect_success 'kvs: clear stats locally' ' - flux kvs unlink -Rf $DIR && - flux module stats -c kvs && - flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 && - flux kvs put $DIR.largeval1=$largeval && - flux kvs put $DIR.largeval2=$largeval && - ! flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 && - flux module stats -c kvs && - flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 -' - -test_expect_success NO_ASAN 'kvs: clear stats globally' ' - flux kvs unlink -Rf $DIR && - flux module stats -C kvs && - flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" && - for i in `seq 0 $((${SIZE} - 1))`; do - flux exec -n -r $i sh -c "flux kvs put $DIR.$i.largeval1=$largeval $DIR.$i.largeval2=$largeval" - done && - ! flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" && - flux module stats -C kvs && - flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" -' - # # test fence api # @@ -534,6 +504,36 @@ test_expect_success 'kvs: 1 pending requests at end of tests before module remov test $pendingcount1 -eq 1 ' +# +# test clear of stats +# + +# each store of largeval will increase the noop store count, b/c we +# know that the identical large value will be cached as raw data + +test_expect_success 'kvs: clear stats locally' ' + flux kvs unlink -Rf $DIR && + flux module stats -c kvs && + flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 && + flux kvs put $DIR.largeval1=$largeval && + flux kvs put $DIR.largeval2=$largeval && + ! flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 && + flux module stats -c kvs && + flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 +' + +test_expect_success NO_ASAN 'kvs: clear stats globally' ' + flux kvs unlink -Rf $DIR && + flux module stats -C kvs && + flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" && + for i in `seq 0 $((${SIZE} - 1))`; do + flux exec -n -r $i sh -c "flux kvs put $DIR.$i.largeval1=$largeval $DIR.$i.largeval2=$largeval" + done && + ! flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" && + flux module stats -C kvs && + flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" +' + # # test ENOSYS on unfinished requests when unloading the KVS module #