Commit 5c5b2fd
committed
fix(scenarios): validate instance_count range and guard against negative values
Per qodo-code-review bot on PR krkn-chaos#1219:
- Add instance_count type and range validation in BaseNetworkChaosConfig.validate()
so negative or non-int values from YAML are caught early with a clear error
- Tighten sampling guard to require isinstance(int) and instance_count > 0
before calling random.sample(), preventing a runtime crash on negative values
Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>1 parent 15f5086 commit 5c5b2fd
File tree
2 files changed
+6
-1
lines changed- krkn/scenario_plugins/network_chaos_ng
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
0 commit comments