Skip to content

Commit

Permalink
cookbook: allow for setting --delay duration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nicktrav committed Jan 26, 2023
1 parent eaf9b0a commit 093371a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cookbook/recipes
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
4 changes: 2 additions & 2 deletions cookbook/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 093371a

Please sign in to comment.