Skip to content

Support variadic parameters in augmented mock client

Compare
Choose a tag to compare
@ChuntaoLu ChuntaoLu released this 17 Jul 17:20
· 259 commits to master since this release
d78103e

This release adds support for variadic parameters in the augmented mock client MockClientWithFixture. This feature applies to any type of clients that has methods of variadic parameters, but particularly applies to generated gRPC clients, where each client method accepts the variadic parameter of type yarpc.CallOption.

One caveat is that Go does not support function comparison (even reflect.DeepEqual won't work), see details in golang/mock#324. So in the case of gRPC mock clients, it is not possible to match the yarpc.CallOption variadic parameters, because it internally has a function field. The workout is to always set Arg{n}Any in the fixture package to the number of variadic parameters so that macther checks pass for them.