Simmy icon indicating copy to clipboard operation
Simmy copied to clipboard

Consider shorter syntax for result stubbing, for use in unit-tests in other systems on how those systems handle faults

Open reisenberger opened this issue 5 years ago • 4 comments

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.

reisenberger avatar Jan 20 '19 14:01 reisenberger

Had ideas of possible alternatives to the previous comment - intending to post a follow-up comment when time available.

reisenberger avatar Mar 22 '19 20:03 reisenberger

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

reisenberger avatar Mar 23 '19 13:03 reisenberger

Wouldn't we want to test each overload with unit test and validate different scenarios for each combinations?

mebjas avatar Apr 11 '19 03:04 mebjas

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.)

reisenberger avatar Jul 07 '19 16:07 reisenberger