gnecula / bond

Spy-based testing library.
http://necula01.github.io/bond/
Other
7 stars 3 forks source link

determine correct behavior for multiple agents #3

Open xkrogen opened 9 years ago

xkrogen commented 9 years ago

If a spy_point has multiple agents set, all with doers, and one of those has a result, what's the expected behavior? I think we need to consistently decide if all agents are applied, or only the most recent one that matches. The two consistent directions I see: (1) More recent agents completely replace older ones (unless they don't meet the matching criteria) and thus only the most recent matching agent does anything (gets its doer called, has its ignore checked, etc). (2) All agents coexist but some have higher priority. All of their doers are run, all of their ignores are checked (but more recent ones take precedence), and then a result is found.

gnecula commented 9 years ago

I think we can drop the "ignore" part. Now we have spy groups which I think are better. We can also simplify the model and say that the last deployed agent whose filters match is the active agent. The doers and the result for that agent are used. The other agents are overridden.

This will be enough for all the use cases I have had.

xkrogen commented 9 years ago

Yeah, I'm in support of that one. I think it's the most simple to understand without any real loss of generality.

gnecula commented 9 years ago

Fixed and committed.

gnecula commented 9 years ago

I was thinking that at some point we may want to add another flag for an agent, whether to continue evaluating previous agents. This would only be useful for the formatters and the doers. Not sure it is worth it.

xkrogen commented 9 years ago

Wouldn't be hard to implement and seems like it could be useful in some situations. Let's leave it as-is for now and maybe do it later?

gnecula commented 9 years ago

I agree that we leave this as a possible future feature.