-
Notifications
You must be signed in to change notification settings - Fork 0
Add validatord integration test for Bitcoin regtest interaction #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| #!/bin/bash | ||||||
| # Integration test script for validatord using bitcoind regtest mode. | ||||||
| # This script validates that the validator daemon can interact with a local | ||||||
| # bitcoin regtest network. | ||||||
|
|
||||||
| set -e | ||||||
|
|
||||||
| echo "=== Validatord Integration Test (regtest) ===" | ||||||
|
|
||||||
| # Check required environment variables | ||||||
| if [ -z "${BITCOIND_RPCURL}" ]; then | ||||||
| echo "BITCOIND_RPCURL environment variable is not set" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| echo "Using BITCOIND_RPCURL: ${BITCOIND_RPCURL}" | ||||||
|
|
||||||
| # Check if the validatord binary exists | ||||||
| if [ ! -f "./validatord" ]; then | ||||||
| echo "Error: validatord binary not found. Please build it first." | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| echo "Found validatord binary" | ||||||
|
|
||||||
| # Run the validatord binary to verify it starts correctly | ||||||
| echo "Starting validatord..." | ||||||
| ./validatord & | ||||||
| VALIDATORD_PID=$! | ||||||
|
|
||||||
| # Wait for validatord to initialize with retry logic | ||||||
| MAX_RETRIES=10 | ||||||
| RETRY_DELAY=1 | ||||||
| for i in $(seq 1 $MAX_RETRIES); do | ||||||
| if kill -0 $VALIDATORD_PID 2>/dev/null; then | ||||||
| echo "Validatord is running (PID: $VALIDATORD_PID, attempt $i)" | ||||||
| # Stop the process gracefully | ||||||
| kill $VALIDATORD_PID 2>/dev/null || true | ||||||
|
||||||
| kill $VALIDATORD_PID 2>/dev/null || true | |
| kill -TERM "$VALIDATORD_PID" 2>/dev/null || true |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test logic always reports success regardless of whether validatord actually runs. If the process exits immediately on all retry attempts (after attempt 1), the loop completes without breaking, but the test still exits with success. The script should explicitly verify that the daemon ran successfully at least once and fail if it never started properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop variable
iis used for counting but$(seq 1 $MAX_RETRIES)creates a subshell. In bash scripts, prefer the more efficient C-style for loop:for ((i=1; i<=MAX_RETRIES; i++)).