Troubleshooting Guide
This guide helps you resolve common issues when using gRPC Testify.
Common Issues
📡 Connection Issues
gRPC Server Not Available
Error: Service at localhost:4770 is not available
Solutions:
Check server status: Ensure your gRPC server is running
bashgrpcurl -plaintext localhost:4770 listVerify port: Confirm the server is listening on the correct port
bashnetstat -an | grep 4770Check firewall: Ensure port is not blocked by firewall
Test with grpcurl directly:
bashgrpcurl -plaintext localhost:4770 your.Service/Method
Connection Timeout
Error: Connection timeout after 30s
Solutions:
Increase timeout in test file:
php--- OPTIONS --- timeout: 60Check network latency
Verify server performance
📄 Test File Issues
Invalid JSON in Request
Error: Failed to parse JSON request
Solutions:
Validate JSON syntax:
bashecho '{"your": "json"}' | jq .Check for trailing commas:
json// ❌ Invalid {"field": "value",} // ✅ Valid {"field": "value"}Escape special characters properly:
json{"path": "/tmp/file", "quote": "He said \"hello\""}
Missing Required Sections
Error: Missing ENDPOINT in test.gctf
Solutions:
Check section names (case-sensitive):
php--- ADDRESS --- ✅ Correct --- address --- ❌ Wrong case --- ADDRESSES --- ❌ Wrong pluralVerify section order (recommended):
php--- ADDRESS --- --- ENDPOINT --- --- REQUEST --- --- ASSERTS ---
🔍 Assertion Failures
jq Expression Errors
Error: jq: error: Invalid jq expression
Solutions:
Test expressions separately:
bashecho '{"status": "ok"}' | jq '.status == "ok"'Common jq patterns:
php# String comparison .message == "success" # Type checking .id | type == "string" # Array operations .items | length > 0 .tags | index("production") != null # Regex matching .email | test("@.*\.com$") # Null checking .error == nullEscape special characters in jq:
php.path | test("^/api/") # Regex .description | contains("test") # Substring
Plugin Assertion Errors
Error: Plugin not found: header
Solutions:
Check plugin syntax:
php# ✅ Correct @header("x-api-version") == "1.0.0" @trailer("x-processing-time") | test("[0-9]+ms") # ❌ Wrong @header(x-api-version) == "1.0.0" # Missing quotes header("x-api-version") == "1.0.0" # Missing @Available plugins:
@header("name")- Response headers@trailer("name")- Response trailers
🔌 gRPC-Specific Issues
Method Not Found
Error: Method not found: YourService/YourMethod
Solutions:
Check service name format:
php# ✅ Correct format package.ServiceName/MethodName # Examples user.UserService/CreateUser api.v1.ProductService/GetProductList available methods:
bashgrpcurl -plaintext localhost:4770 list grpcurl -plaintext localhost:4770 list your.ServiceNameCheck protobuf definitions
Authentication Issues
Error: Unauthenticated or Permission denied
Solutions:
Add authentication headers:
php--- REQUEST_HEADERS --- authorization: Bearer your-token-here x-api-key: your-api-keyUse TLS if required:
php--- TLS --- enabled: true cert_file: "client.crt" key_file: "client.key" ca_file: "ca.crt"
Streaming Support
Status: All streaming types are now fully supported:
- ✅ Client Streaming: Multiple REQUEST sections
- ✅ Server Streaming: Single request, streaming responses
- ✅ Bidirectional Streaming: Interactive request/response patterns
- ✅ Unary RPC: Standard request/response patterns
🚀 Performance Issues
Slow Test Execution
Problem: Tests take too long to run
Solutions:
Use parallel execution:
bash./grpctestify.sh tests/ --parallel 4Optimize timeouts:
php--- OPTIONS --- timeout: 10 # Reduce if possibleProfile server performance
High Memory Usage
Problem: grpctestify uses too much memory
Solutions:
Reduce parallel workers:
bash./grpctestify.sh tests/ --parallel 2Split large test suites
Optimize test data size
Debugging Tips
🔍 Verbose Mode & Dry-Run
Enable detailed logging:
./grpctestify.sh test.gctf --verbosePreview commands without execution (for debugging):
./grpctestify.sh test.gctf --dry-runCombined debugging:
./grpctestify.sh test.gctf --dry-run --verbose📊 Test Individual Files
Test files one by one to isolate issues:
./grpctestify.sh specific_test.gctf🛠️ Validate with grpcurl
Test your server directly:
# List services
grpcurl -plaintext localhost:4770 list
# Test method
grpcurl -plaintext \
-d '{"id": "123"}' \
localhost:4770 \
your.Service/GetItem📋 Check Dependencies
Ensure all required tools are installed:
# Check grpcurl
grpcurl --version
# Check jq
jq --version
# Check gRPC Testify
./grpctestify.sh --versionGetting Help
📚 Documentation
🐛 Reporting Issues
When reporting issues, include:
- gRPC Testify version:
./grpctestify.sh --version - Test file content (sanitized)
- Error message (complete)
- Environment details (OS, Go version)
- Steps to reproduce
💡 Tips for Better Tests
- Start simple: Begin with basic unary calls
- Test incrementally: Add complexity gradually
- Use meaningful names: Make test files descriptive
- Validate early: Check JSON syntax before running
- Monitor servers: Ensure stable gRPC services
- Version control: Track test file changes
Advanced Troubleshooting
🔧 Custom Debugging
For complex issues, you can:
Enable trace mode:
bashset -x ./grpctestify.sh test.gctf set +xCheck generated grpcurl commands: Look for the actual grpcurl calls in verbose output
Inspect intermediate files: Temporary files are created during test execution
Network analysis: Use tools like
tcpdumporwiresharkfor network issues
🏥 Recovery Strategies
When tests fail consistently:
- Reset environment: Restart servers and clear caches
- Validate baseline: Test with minimal examples first
- Check dependencies: Update grpcurl, jq, and other tools
- Review changes: Compare with working versions
- Isolate variables: Test different servers, networks, or configurations
Quick Reference
Exit Codes
0: All tests passed1: Test failures or errors2: Invalid arguments3: Missing dependencies
Environment Variables
GRPCTESTIFY_ADDRESS: Default server addressGRPCTESTIFY_ADDRESS: Default gRPC server addressGRPCTESTIFY_PLUGIN_DIR: Directory for external plugins
File Extensions
.gctf: gRPC test configuration files.proto: Protocol buffer definitions (for reference)
This troubleshooting guide covers the most common issues. For specific problems not covered here, consult the API reference or create an issue with detailed information.