From 093371af859746358d66426d0424ae6b4e7ccf2d Mon Sep 17 00:00:00 2001 From: Nick Travers Date: Thu, 26 Jan 2023 15:17:26 -0800 Subject: [PATCH] cookbook: allow for setting --delay duration The CockroachDB test suite currently makes use of charybdefs-nemesis to induce artificial delays into the filesystem to simulate disk stalls. Currently, the delay duration is fixed at 50ms. This precludes testing of faults that last indefinitely. Change the format of the `--delay` command to take a duration, in microseconds, allowing for faults of a longer duration. --- cookbook/recipes | 2 +- cookbook/recipes.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/recipes b/cookbook/recipes index 5d1ad84..1dc52de 100755 --- a/cookbook/recipes +++ b/cookbook/recipes @@ -4,4 +4,4 @@ if [ ! -d gen-py ]; then thrift -r --gen py ../server.thrift &> /dev/null fi -python2 recipes.py $1 +python2 recipes.py "$@" diff --git a/cookbook/recipes.py b/cookbook/recipes.py index 9922f92..23c0bd7 100644 --- a/cookbook/recipes.py +++ b/cookbook/recipes.py @@ -17,7 +17,7 @@ def usage(): " --full\n" " --io-error\n" " --quota\n" - " --delay\n" + " --delay DELAY_MICROS\n" " --random\n" " --specific-syscalls\n" " --probability\n" @@ -57,7 +57,7 @@ def main(): client.set_all_fault(False, [errno.EDQUOT], 0, "", False, 0, False) elif sys.argv[1] == "--delay": print("Simulating delayed IO") - client.set_all_fault(False, [], 0, "", False, 50000, False) + client.set_all_fault(False, [], 0, "", False, sys.argv[2], False) elif sys.argv[1] == "--random": # Use all errnos, minus any specified in trailing arguments. errnos_selected = {code: name for code, name in