Help with Stubbing Golang gremlin-go V3 Package

I'm using the gremlin-go V3 package and I'm trying to find an easy way to mock for testing. Has anyone successfully created a Mock Package/Interface? My code currently uses: GraphTraversalSource DriverRemoteConnection And the actual connection structs/interfaces are pretty deep into these. Running any method that actually submits the Query causes a panic because I don't have a test connection. I know I have a couple options like creating my own interface wrapper, and creating my own stub client, however I'm wondering if anyone has solved this?
2 Replies
Andrea
Andrea4d ago
The gremlin-go driver uses mock library for mocking, perhaps you could do something similar: https://github.com/apache/tinkerpop/blob/3.7-dev/gremlin-go/driver/gorillaTransporter_test.go
Benerro
BenerroOP4d ago
yeah thats an option, though the base structs I'm using build on a few levels from that. I'll look more into that, but I'll probably Wrap the methods that require network connection in an interface for myself

Did you find this page helpful?