From 294efa52d47be083704da51b148c685d347be4ac Mon Sep 17 00:00:00 2001 From: Anita Zhang Date: Tue, 8 Jun 2021 00:04:35 -0700 Subject: [PATCH] test: add extended test for triggering mount rate limit It's hard to trigger the failure to exit the rate limit state in isolation as it needs multiple event sources in order to show that it gets stuck in the queue. Hence why this is an extended test. (cherry picked from commit 0c81900965a72b29eb76e0737ed899b925ee75b6) Related: #2094712 --- test/TEST-60-MOUNT-RATELIMIT/Makefile | 1 + test/TEST-60-MOUNT-RATELIMIT/test.sh | 48 +++++++++++++++ test/TEST-60-MOUNT-RATELIMIT/testsuite.sh | 73 +++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 120000 test/TEST-60-MOUNT-RATELIMIT/Makefile create mode 100755 test/TEST-60-MOUNT-RATELIMIT/test.sh create mode 100755 test/TEST-60-MOUNT-RATELIMIT/testsuite.sh diff --git a/test/TEST-60-MOUNT-RATELIMIT/Makefile b/test/TEST-60-MOUNT-RATELIMIT/Makefile new file mode 120000 index 0000000000..e9f93b1104 --- /dev/null +++ b/test/TEST-60-MOUNT-RATELIMIT/Makefile @@ -0,0 +1 @@ +../TEST-01-BASIC/Makefile \ No newline at end of file diff --git a/test/TEST-60-MOUNT-RATELIMIT/test.sh b/test/TEST-60-MOUNT-RATELIMIT/test.sh new file mode 100755 index 0000000000..e3c9288546 --- /dev/null +++ b/test/TEST-60-MOUNT-RATELIMIT/test.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -e +TEST_DESCRIPTION="Test that mount/unmount storms can enter/exit rate limit state and will not leak units" + +. $TEST_BASE_DIR/test-functions + +test_setup() { + create_empty_image + mkdir -p $TESTDIR/root + mount ${LOOPDEV}p1 $TESTDIR/root + + ( + LOG_LEVEL=5 + eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) + + setup_basic_environment + + # mask some services that we do not want to run in these tests + ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket + ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + + # setup the testsuite service + cat >$initdir/etc/systemd/system/testsuite.service </testok + +exit 0