Testing
Before deploying your subgraph, it is crucial to test the handler code thoroughly. This testing process involves populating a local or remote MongoDB instance with sample data, allowing you to validate the indexing and data transformation logic.
To test your instance, you'll need an RPC endpoint for the network your instance is built on. You can use any RPC provider, but we recommend this provider.
Local MongoDB Setup
Setting up a local MongoDB instance is the recommended approach for efficient testing. You can follow the official MongoDB installation guide to set up a local MongoDB server on your machine. Once the local MongoDB is up and running, you can use the following command to initiate the testing process:
This command will populate your local MongoDB database with sample documents based on your configuration. You can then use the MongoDB client or a GUI tool to query and inspect the indexed data, ensuring that the handlers are functioning correctly.
Remote Mongo Connection
If you prefer not to set up a local MongoDB instance, you can utilize a remote MongoDB connection. First, you'll need to obtain a connection URI for a remote MongoDB instance. You can follow the provided tutorial to retrieve the connection URI.
Once you have the connection URI, use the following command to initiate the testing process:
Replace "your-connection-uri"
with the actual connection URI for your remote MongoDB instance. This command will populate the remote database with sample documents, allowing you to test your handlers against the remote data.
While both local and remote testing options are available, it is highly recommended to use a local MongoDB setup for faster operations and more efficient testing iterations.
Testing Caveats and Options
The Blockflow CLI provides several caveats and options to customize the testing process for your instances. These options allow you to fine-tune the testing environment and behaviour according to your specific requirements.
It's recommended to review the complete list of options by running.
Last updated