|
| 1 | +# **Amazon Neptune Utility for GraphQL™ Tests** |
| 2 | + |
| 3 | +The Amazon Neptune Utility for GraphQL project contains unit and integration |
| 4 | +tests. When contributing changes to the project, one should ensure that these |
| 5 | +tests are updated accordingly and are successful before opening a pull request. |
| 6 | + |
| 7 | +All unit and integration tests can be executed with the following command: |
| 8 | + |
| 9 | +``` |
| 10 | +npm test |
| 11 | +``` |
| 12 | + |
| 13 | +## Unit Tests |
| 14 | + |
| 15 | +Unit tests do not require a neptune db cluster or graph and can be executed with |
| 16 | +the following command: |
| 17 | + |
| 18 | +``` |
| 19 | +npm run test:unit |
| 20 | +``` |
| 21 | + |
| 22 | +## Integration Tests |
| 23 | + |
| 24 | +Integration tests execute against a live neptune db cluster or graph and require |
| 25 | +the following prerequisites to run: |
| 26 | + |
| 27 | +1. test dependencies installed by executing `npm install` from the `test` |
| 28 | + directory |
| 29 | +2. neptune db cluster or graph which is accessible from the machine running the |
| 30 | + tests and |
| 31 | + is [loaded with the airports sample dataset](#loading-airports-sample-data-into-neptune) |
| 32 | + 3, AWS credentials configured appropriately on the machine running the tests |
| 33 | + to allow query access to the neptune db or cluster |
| 34 | +4. AWS IAM configured to allow creation of AWS resources necessary to deploy an |
| 35 | + App Sync API |
| 36 | +5. environment variables `AIR_ROUTES_DB_HOST` and `AIR_ROUTES_DB_PORT` set to |
| 37 | + identify the neptune db cluster or graph, for example: |
| 38 | + |
| 39 | +``` |
| 40 | +# neptune db cluster |
| 41 | +export AIR_ROUTES_DB_HOST=air-routes.cluster-123.us-west-2.neptune.amazonaws.com |
| 42 | +export AIR_ROUTES_DB_PORT=8182 |
| 43 | +``` |
| 44 | + |
| 45 | +``` |
| 46 | +# neptune analytics graph |
| 47 | +export AIR_ROUTES_DB_HOST=g-abc123.us-west-2.neptune-graph.amazonaws.com |
| 48 | +export AIR_ROUTES_DB_PORT=8182 |
| 49 | +``` |
| 50 | + |
| 51 | +To execute the integration tests use the following command: |
| 52 | + |
| 53 | +``` |
| 54 | +npm run test:integration |
| 55 | +``` |
| 56 | + |
| 57 | +## Loading Airports Sample Data Into Neptune |
| 58 | + |
| 59 | +The easiest way to load the airports sample data into Neptune is using |
| 60 | +the [%seed line magic](https://docs.aws.amazon.com/neptune/latest/userguide/notebooks-magics.html#notebooks-line-magics-seed) |
| 61 | +in a Neptune notebook. To set up a Neptune notebook |
| 62 | +see [Using Amazon Neptune with graph notebooks](https://docs.aws.amazon.com/neptune/latest/userguide/graph-notebooks.html) |
| 63 | +and [Using notebooks with Neptune Analytics](https://docs.aws.amazon.com/neptune-analytics/latest/userguide/notebooks.html). |
| 64 | + |
| 65 | + |
| 66 | +> [!TIP] |
| 67 | +> The integration tests expect neptune db clusters to be loaded with the |
| 68 | +> airports `gremlin` sample dataset and neptune analytics graphs to be loaded |
| 69 | +> with |
| 70 | +> the airports `opencypher` sample dataset (the gremlin airports dataset is not |
| 71 | +> available for neptune analytics). |
| 72 | +
|
| 73 | + |
| 74 | + |
| 75 | + |
0 commit comments