Skip to content

Commit 654621e

Browse files
committed
testsuite: cover flux module trace
Problem: flux module trace has no test coverage Add a sharness test.
1 parent 0fbc62c commit 654621e

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ TESTSCRIPTS = \
255255
t3308-system-torpid.t \
256256
t3309-system-reconnect.t \
257257
t3400-overlay-trace.t \
258+
t3401-module-trace.t \
258259
lua/t0001-send-recv.t \
259260
lua/t0002-rpc.t \
260261
lua/t0003-events.t \

t/t3401-module-trace.t

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
3+
test_description='Test flux module trace'
4+
5+
. $(dirname $0)/sharness.sh
6+
7+
test_under_flux 1
8+
9+
waitfile="${SHARNESS_TEST_SRCDIR}/scripts/waitfile.lua"
10+
11+
test_expect_success 'flux module trace fails with missing module name' '
12+
test_must_fail flux module trace
13+
'
14+
test_expect_success 'flux module trace fails with unknown argument' '
15+
test_must_fail flux module trace --not-an-arg
16+
'
17+
test_expect_success 'flux module trace fails with wrong message type' '
18+
test_must_fail flux module trace -t foo,bar
19+
'
20+
test_expect_success 'reload heartbeat with increased heart rate' '
21+
flux module reload heartbeat period=0.2s
22+
'
23+
test_expect_success NO_CHAIN_LINT 'start background trace' '
24+
flux module trace kvs >trace.out &
25+
echo $! >trace.pid
26+
'
27+
test_expect_success NO_CHAIN_LINT 'heartbeat.pulse event was captured' '
28+
$waitfile -t 60 -p heartbeat.pulse trace.out
29+
'
30+
test_expect_success NO_CHAIN_LINT 'send one kvs.ping' '
31+
flux ping -c 1 kvs
32+
'
33+
test_expect_success NO_CHAIN_LINT 'kvs.ping request/response was captured' '
34+
$waitfile -t 60 -c 2 -p kvs.ping trace.out
35+
'
36+
test_expect_success NO_CHAIN_LINT 'stop background trace' '
37+
kill -15 $(cat trace.pid); wait || true
38+
'
39+
40+
test_expect_success NO_CHAIN_LINT 'start background trace on multiple modules' '
41+
flux module trace kvs barrier >trace2.out &
42+
echo $! >trace2.pid
43+
'
44+
test_expect_success NO_CHAIN_LINT 'heartbeat.pulse event was captured' '
45+
$waitfile -t 60 -p heartbeat.pulse trace2.out
46+
'
47+
test_expect_success NO_CHAIN_LINT 'send one barrier.ping' '
48+
flux ping -c 1 barrier
49+
'
50+
test_expect_success NO_CHAIN_LINT 'barrier.ping request/response was captured' '
51+
$waitfile -t 60 -c 2 -p barrier.ping trace2.out
52+
'
53+
test_expect_success NO_CHAIN_LINT 'stop background trace' '
54+
kill -15 $(cat trace2.pid); wait || true
55+
'
56+
test_done

0 commit comments

Comments
 (0)