This crate contains integration tests for the Engine server with full code coverage. Tests programmatically start the Engine server within the test process, following the same pattern as the Vault integration tests.
cd integration-tests/configuration
cp test_local.yaml.example test_local.yaml
# Edit test_local.yaml and fill in your credentials# Start Redis
redis-server
# Start Vault (or use remote Vault)
# Update vault.url in test_local.yamlcargo test -p engine-integration-testsTests use YAML configuration files (like the server does):
test_base.yaml- Base configuration with defaults and structuretest_local.yaml- Local overrides (create from.examplefile)
vault:
url: http://127.0.0.1:3001
redis:
url: redis://127.0.0.1:6379
thirdweb:
secret_key: YOUR_SECRET_KEY_HERE # Required!
client_id: YOUR_CLIENT_ID_HERE # Required!
urls:
rpc: https://rpc.thirdweb-dev.com
bundler: https://bundler.thirdweb-dev.com
# ... other URLs
solana:
devnet:
http_url: https://api.devnet.solana.com
ws_url: wss://api.devnet.solana.com
# ... mainnet, local
queue:
# Test-optimized queue configuration
webhook_workers: 1
solana_executor_workers: 1
# ... other workersYou can override any config value with environment variables using TEST_ prefix:
# Override vault URL
export TEST__VAULT__URL=http://localhost:3001
# Override thirdweb secret
export TEST__THIRDWEB__SECRET_KEY=your_key
# Run tests
cargo test -p engine-integration-testsThe tests import and start Engine server components directly:
- No external server required - server is started programmatically
- Full code coverage - all server code runs in the test process
- Isolated environments - each test gets its own server instance
- Proper cleanup - resources are automatically cleaned up after tests
-
Redis: Tests require a running Redis instance
docker run -d -p 6379:6379 redis:latest # or redis-server -
Vault: Tests require access to a Vault instance
# Configure vault.url in test_local.yaml
Fill in these values in configuration/test_local.yaml:
- ✅
thirdweb.secret_key- Get from https://thirdweb.com/dashboard - ✅
thirdweb.client_id- Get from https://thirdweb.com/dashboard - ✅
vault.url- Your Vault instance URL - ✅
redis.url- Your Redis instance URL
cargo test -p engine-integration-testscargo test -p engine-integration-tests test_partial_signature_spl_transferRUST_LOG=debug cargo test -p engine-integration-tests -- --nocapture# Use test_staging.yaml instead of test_local.yaml
TEST_ENVIRONMENT=staging cargo test -p engine-integration-testsThis test demonstrates the core partial signature flow:
- Test Environment Setup: Programmatically starts Engine server using config files
- Vault Wallet Creation: Creates a service account and Solana wallet in Vault
- Transaction Construction: Builds a system transfer transaction where the Vault wallet is fee payer
- HTTP API Call: Sends unsigned transaction to Engine's
/v1/solana/sign/transactionendpoint - Vault Signing: Engine uses Vault to sign the transaction
- Verification: Confirms the signature is valid and properly positioned
- Broadcast Ready: Transaction is fully signed and ready for broadcast
What it tests:
- Server initialization and routing
- Configuration loading from YAML files
- HTTP API endpoint for transaction signing
- Vault integration for key management
- Partial signature scenarios
- Transaction serialization/deserialization (bincode + base64)
- Signature verification using Solana SDK v3
Tests that:
- Signatures are properly applied to transactions
- Signature format is correct (base58)
- Signatures can be parsed and validated
- Signed transactions match expected structure
- Non-default signatures indicate proper signing
Tests error cases:
- Invalid base64 transaction data
- Malformed requests
- Proper error response formatting
- HTTP status codes
integration-tests/
├── configuration/
│ ├── test_base.yaml # Base config with defaults
│ ├── test_local.yaml.example # Example local config
│ └── test_local.yaml # Your local config (git-ignored)
├── src/
│ └── lib.rs # Helper functions
└── tests/
├── setup.rs # TestEnvironment + config loading
└── sign_solana_transaction.rs # Test cases
The TestEnvironment loads configuration from YAML files:
let env = TestEnvironment::new("test_name").await?;This:
- Loads
test_base.yamlfor defaults - Merges
test_local.yamlfor overrides - Applies environment variable overrides (
TEST__*) - Initializes all Engine components from config
- Starts HTTP server on random available port
- Returns environment ready for testing
#[tokio::test]
async fn my_test() -> Result<()> {
// Start server programmatically (uses YAML config)
let env = TestEnvironment::new("my_test").await?;
// Create test wallet in Vault
let (admin_key, wallet) = create_test_solana_wallet(env.vault_client()).await?;
// Make HTTP requests to env.server_url()
let response = client
.post(&format!("{}/v1/solana/sign/transaction", env.server_url()))
.header("x-vault-access-token", format!("Bearer {}", admin_key))
.json(&request)
.send()
.await?;
// Test assertions...
Ok(())
}This test suite uses Solana SDK v3 features according to the migration guide:
Addresstype (thoughPubkeyremains as type alias)VersionedTransactionfor modern transaction formatv0::Messagefor versioned message constructionsolana-system-interfacev2 (compatible with SDK v3)- Proper signature verification with SDK v3 APIs
Hash::as_bytes()for hash access (private inner bytes in v3)
- Ensure
configuration/test_local.yamlexists - Copy from
test_local.yaml.exampleif needed - Check YAML syntax is valid
- Ensure Redis is running:
redis-cli pingshould returnPONG - Check
redis.urlin configuration - For tests:
docker run -d -p 6379:6379 redis:latest
- Ensure Vault server is running
- Check
vault.urlin configuration - Verify network connectivity to Vault
- Fill in
thirdweb.secret_keyintest_local.yaml - Fill in
thirdweb.client_idintest_local.yaml - Get credentials from https://thirdweb.com/dashboard
- Check Redis is responsive
- Verify Vault is accessible
- Look for port conflicts (server uses random ports)
- Check logs with
RUST_LOG=debug
Since the server runs in-process, all code executed during tests is included in code coverage reports:
# Generate coverage report
cargo tarpaulin --out Html --output-dir coverage -p engine-integration-tests
# Or use llvm-cov
cargo llvm-cov --html -p engine-integration-testsThis captures:
- Server initialization code
- Configuration loading
- HTTP routing and handlers
- Vault integration code
- Transaction signing logic
- Error handling paths
- Serialization/deserialization
- Add tests for transaction broadcast to local Solana validator
- Test different chain IDs (mainnet, devnet, testnet, local)
- Add performance/benchmarking tests
- Test error scenarios (rate limits, network failures)
- Add tests for compute budget instructions
- Test with address lookup tables (v0 transactions)