From 497fc5fb06835e811dcbe7cf68f60644c43cce8d Mon Sep 17 00:00:00 2001 From: Antonio Russo Date: Mon, 8 Mar 2021 09:42:45 -0700 Subject: [PATCH] ZTS events_002: Improve speed and reliability events_002 exercises the ZED, ensuring that it neither misses events, nor reporting events twice. On slow test hardware, some of the timeouts are insufficient to allow the ZED to properly settle. Conversely, on fast hardware these same timeouts are too long, unnecessarily slowing the test run. Instead of using a fixed timeout, wait for the expected final event before returning. Additionally, wait with a timeout for unexpected events to avoid missing them if they show up late. Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Signed-off-by: Antonio Russo Closes #11703 --- tests/zfs-tests/tests/functional/events/events_002_pos.ksh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/zfs-tests/tests/functional/events/events_002_pos.ksh b/tests/zfs-tests/tests/functional/events/events_002_pos.ksh index 7a78d93a8..586eaa9e1 100755 --- a/tests/zfs-tests/tests/functional/events/events_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/events/events_002_pos.ksh @@ -66,7 +66,7 @@ log_must zpool create $MPOOL mirror $VDEV1 $VDEV2 # 2. Start the ZED and verify it handles missed events. log_must zed_start -log_must file_wait $ZED_DEBUG_LOG +log_must file_wait_event $ZED_DEBUG_LOG 'sysevent\.fs\.zfs\.config_sync' 150 log_must cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED awk -v event="sysevent.fs.zfs.pool_create" \ @@ -92,12 +92,11 @@ done # 5. Start the ZED and verify it only handled the new missed events. log_must zed_start -log_must file_wait $ZED_DEBUG_LOG 35 +log_must file_wait_event $ZED_DEBUG_LOG 'sysevent\.fs\.zfs\.resilver_finish' 150 log_must cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED -log_mustnot grep -q "sysevent.fs.zfs.pool_create" $TMP_EVENTS_ZED +log_mustnot file_wait_event $ZED_DEBUG_LOG 'sysevent\.fs\.zfs\.pool_create' 30 log_must grep -q "sysevent.fs.zfs.vdev_online" $TMP_EVENTS_ZED log_must grep -q "sysevent.fs.zfs.resilver_start" $TMP_EVENTS_ZED -log_must grep -q "sysevent.fs.zfs.resilver_finish" $TMP_EVENTS_ZED log_pass "Verify ZED handles missed events on when starting"