Quoting Jon Loeliger (2017-11-10 23:11:36)

>    First, this is draconian for no really good reason.  Second, it should be
>    fixed.  Third, I would do that except I am stupid and need a clue where
>    or how to fix this situation so the tests are less draconian.  (Can we
>    get a "less than 0" test instead of "equal to -1"?)

When writing the logic, it was sufficient (so far) for everybody to just
know what is the correct value to expect (0, -1, ..). If there really is
a situation when an API call can have a random (from the client's view)
return value, I can think of two approaches to deal with this...

1.) introduce a special case "expected_retval=None" which just skips
verifying the return value (in framework) leaving this up to the caller
2.) allow passing a functor instead of the expected value, which
fulfills the role of validator and have the call it, supplying the actual
"retval" from API response message as a parameter to the functor to figure
out whether it's one of the expected ones or nor ...

Thanks,
Klement
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to