The mock server code in this folder is used for observing requests that will be sent to the server. When the server sends back a vague error it is often because the request it receives is incorrect so it is crucial to have a tool to view the request in order to know what client library code needs to change.
The steps to follow for using the mock server is:
- Take a look at
test/try-server.tsto see how the mock server is used. - In the system test you want to debug, change
ittoit.onlyto isolate that test. - In this test, surround the code with
startServer(async () => { - Ensure
apiEndpoint: 'localhost:50051'is passed into the datastore client that is used for this test. - If the system test hits an endpoint other than
runQuerythen indatastore-server.ts, change.addService(service, {runQuery: grpcEndpoint})to.addService(service, {<<OtherGrpcEndpoint>>: grpcEndpoint}) - Set a breakpoint on the line that says
SET A BREAKPOINT HEREindatastore-server.ts - Debug with system tests (Enter
npm run system-test -- --inspectin terminal)