main: add configurable fault injection interval#98
Conversation
|
@acerv hello, can you review these changes please? |
|
Hi, what's the point of having a probability bigger than 100 if the kernel threats any value above 100 as 100 ? |
The idea is to modify the interval between probability checks, rather than the probability itself. I haven't really changed the probability in code. Right now 100% probability of failure grants that every 100th call will fail (interval=100). So, with different intervals, it is possible, for example, to have fails (or probability checks if below 100%) every 10th call (interval=10). Or, with an interval set to 1 and a probability to 10%, each call may fail with that probability. docs: |
|
Of course, I was switching between reviews and messed up this one. Now it's clear thanks |
| except TypeError as err: | ||
| raise argparse.ArgumentTypeError("Invalid number") from err | ||
|
|
||
| return 100 if ret < 0 else ret |
There was a problem hiding this comment.
This is a bit counterintuitive. If the value is below 1, we should default it to 1.
There was a problem hiding this comment.
Changed it to return max(1, ret)
| assert libkirk.main._finjection_config("-5") == 0 | ||
|
|
||
| def test_finterval_config_empty(self): | ||
| assert libkirk.main._finterval_config("") == 100 |
There was a problem hiding this comment.
We should add a test for real values. Maybe we can create a parametric test passing them as following:
@pytest.mark.parametrize("val", ("0", "20", "100", "2000"))
def test_finterval_config(self, val):
assert libkirk.main._finterval_config(val) == int(val)
| exec_opts.add_argument( | ||
| "--fault-interval", | ||
| type=_finterval_config, | ||
| default=100, |
There was a problem hiding this comment.
Default interval value is 1, according to documentation. This has to be changed.
There was a problem hiding this comment.
I agree, but thought of keeping the original value. Changed it now.
ad4b111 to
6c3b3bd
Compare
Adds a parameter to configure the fault injection interval, which is locked at default 100.
Can be used to make the fault injection probability checks more frequent. This would lead to a more thorough test of system stability.