Closed mattharrigan closed 4 years ago
Hello,
Thanks for pointing this out. I need to update the README.md
.
You can use grpchandler.NewCompositeMockService([]MockService) MockService
to start multiple services.
So your code to start multiple services becomes:
package main
import (
"github.com/carvalhorr/protoc-gen-mock/bootstrap"
greetermock "github.com/carvalhorr/protoc-gen-mock/greeter-service"
...
"github.com/carvalhorr/protoc-gen-mock/grpchandler"
"github.com/carvalhorr/protoc-gen-mock/stub"
)
func main() {
bootstrap.BootstrapServers("./tmp/", 1068, 10010, MockServicesRegistersCallback)
}
var MockServicesRegistersCallback = func(stubsMatcher stub.StubsMatcher) grpchandler.MockService {
return grpchandler.NewCompositeMockService([]grpchandler.MockService{
greetermock.NewGreeterMockService(stubsMatcher),
othermock.NewOtherMockService(stubsMatcher),
})
}
Hope this helps.
Rodrigo
perfect, thank you
Is it possible to mock multiple services with a single server? It looks like bootstrap used to accept a slice of services to mock, but that was changed in this commit. Did this functionality move somewhere else? This was one reason I really like this module.
The readme example still has the slice version of the API.
Thanks