Skip to content

Commit

Permalink
t: add new kvs watch append tests
Browse files Browse the repository at this point in the history
Problem: Additional coverage of the new kvs watch append
behavior is needed.

Add new tests in t1007-kvs-lookup-watch.t.
  • Loading branch information
chu11 committed Dec 4, 2024
1 parent 15186dd commit ca56ea7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions t/t1007-kvs-lookup-watch.t
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,31 @@ f
test_cmp expected append1.out
'

# N.B. When the data is small `flux kvs put foo=...` create a "val" treeobj.
# when the value is larger, it creates a "valref" treeobj
largeval="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"

test_expect_success NO_CHAIN_LINT 'flux kvs get: basic --watch & --append works (initial valref)' '
flux kvs unlink -Rf test &&
echo -n ${largeval} | flux kvs put --raw test.append.test=- &&
flux kvs get --treeobj test.append.test | grep valref &&
flux kvs get --watch --append --count=4 \
test.append.test > append1.out 2>&1 &
pid=$! &&
wait_watcherscount_nonzero primary &&
flux kvs put --append test.append.test="1" &&
flux kvs put --append test.append.test="2" &&
flux kvs put --append test.append.test="3" &&
wait $pid &&
cat >expected <<-EOF &&
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
1
2
3
EOF
test_cmp expected append1.out
'

test_expect_success NO_CHAIN_LINT 'flux kvs get: --append works with empty string' '
flux kvs unlink -Rf test &&
flux kvs put test.append.test="abc" &&
Expand Down Expand Up @@ -396,6 +421,21 @@ test_expect_success NO_CHAIN_LINT 'flux kvs get: --append fails on fake append'
test_must_fail wait $pid
'

# N.B. valref treeobj now has fewer entries
test_expect_success NO_CHAIN_LINT 'flux kvs get: --append fails on fake append (valref)' '
flux kvs unlink -Rf test &&
flux kvs put test.append.test="abc" &&
flux kvs get --watch --append --count=4 \
test.append.test > append7.out 2>&1 &
pid=$! &&
wait_watcherscount_nonzero primary &&
flux kvs put --append test.append.test="d" &&
flux kvs put --append test.append.test="e" &&
echo -n ${largeval} | flux kvs put --raw test.append.test=- &&
flux kvs get --treeobj test.append.test | grep valref &&
test_must_fail wait $pid
'

# full checks

# in full checks, we create a directory that we will use to
Expand Down

0 comments on commit ca56ea7

Please sign in to comment.