Simmy
Simmy copied to clipboard
Consider shorter syntax for result stubbing, for use in unit-tests in other systems on how those systems handle faults
All current overloads are of the form:
MonkeyPolicy.InjectX(/* what to inject */, Double injectionRate, bool enabled) // or similar Func variants for injectionRate and enabled
Unit tests are likely to always want to inject the fault/response (ie injectionRate: 1
and enabled: true
). Propose: Add syntax overloads throughout, of the form:
MonkeyPolicy.InjectX(/* what to inject */)
which chain on to injectionRate: 1
and enabled: true
.
Timing
Would be nice to have this before launch, as stubbing for unit-tests is a major use case we can advertise, as part of the launch
See also #16 . Makes sense to implement #16 before this.
Had ideas of possible alternatives to the previous comment - intending to post a follow-up comment when time available.
Maybe we take this out of scope of the initial launch, so that we can get a first chaos-engineering version out.
Leaving the issue open, but removing the 'Initial launch' milestone
Wouldn't we want to test each overload with unit test and validate different scenarios for each combinations?
Clarification: this issue is not about how we write unit tests within the Simmy repo on Simmy policies, but about how Simmy could be used as a tool to provide stub fault responses, for users to test their Polly policies in other apps. Similar to #16.
This #17 is about whether we want overloads defaulting to injectionRate: 1
and enabled: true
, for the use case of always injecting the fault, for a unit-test. But maybe we don't need the extra overload - maybe it just adds extra API surface which would confuse the (majority) chaos use case. Maybe it is enough to demonstrate in a blog post/wiki page how one could use the existing syntax with injectionRate: 1
and enabled: true
to stub a result in a unit test.
#16 is about whether InjectResult()
would be a more neutral language for overloads than InjectFault
. (In unit-testing, not every result you want to stub in is a fault.)