Run tests for a gRPC router plugin
test
command runs tests for your gRPC router plugin to verify its functionality.
Argument | Description | Default |
---|---|---|
directory | Directory of the plugin | . (current directory) |
Option | Description | Default |
---|---|---|
--skip-tools-installation | Skip tool installation | false |
--force-tools-installation | Force tools installation regardless of version check or confirmation | false |
src
directory--skip-tools-installation
and --force-tools-installation
flags.
For debugging your plugin, use the --debug
flag to build with debug symbols. This enables debugging with tools like Delve, GoLand, or VS Code. See the debugging guide for detailed instructions.
You can also install the dependencies manually and use an IDE with Go support. The following table shows the current versions and download links for the required tools:
Tool | Version | Installation Link |
---|---|---|
Go | >=1.22.0 (Last 2 versions) | Releases |
Protocol Buffers (protoc) | ^29.3 | Releases |
protoc-gen-go | ^1.34.2 | GitHub Releases |
protoc-gen-go-grpc | ^1.5.1 | GitHub Releases |
wgc router plugin init
, a test file is automatically created at src/main_test.go
. This file includes a basic test setup that you can expand with your own test cases.
The default test file tests the plugin’s ability to handle basic GraphQL queries. You should add additional tests to cover your custom resolver logic.