Testing against AWS Neptune
Hi, the app that I'm maintaining has a Neptune integration for which I've written some integration tests. For those tests I'm using gremlin-server which so far is fine, but because of the cardinality difference between Neptune and other Gremlin implementation I get different behaviour in prod vs testing. Of course, this is a known difference, but I'm wondering if there's a solution that emulates the Neptune engine locally for such use cases.
I could spin-up a new Neptune instance at testing time, but that seems a bit of an anti-pattern. What do people do to test the clients against multiple engines, if at all?
I could spin-up a new Neptune instance at testing time, but that seems a bit of an anti-pattern. What do people do to test the clients against multiple engines, if at all?
Solution
Hi, the main solution I've seen around for such use case (and I'm using myself) is to start the gremlin-server using a custom configuration.
Basically what you need to do is create a custom 'gremlin-server.yaml' file with the server config. There is a field called
This property file is where you define your graph properties, and in your case the
Here is the configuration that I use to mimic Neptune :
I believe this is explained somewhere in the gremlin server documentation but I don't remember where.
A good starting point is this book which I found very useful to start with gremlin server : https://www.kelvinlawrence.net/book/PracticalGremlin.html#serverconfig
(Kelvin Lawrence is in the discord by the way)
Basically what you need to do is create a custom 'gremlin-server.yaml' file with the server config. There is a field called
graphs in this file, which you can use to specify the path to a custom property file.This property file is where you define your graph properties, and in your case the
defaultCardinality.Here is the configuration that I use to mimic Neptune :
I believe this is explained somewhere in the gremlin server documentation but I don't remember where.
A good starting point is this book which I found very useful to start with gremlin server : https://www.kelvinlawrence.net/book/PracticalGremlin.html#serverconfig
(Kelvin Lawrence is in the discord by the way)