Skip to content

testing some rpcserver calls#1016

Draft
vncoelho wants to merge 3 commits into
master-n3from
actionWithRpcCalls
Draft

testing some rpcserver calls#1016
vncoelho wants to merge 3 commits into
master-n3from
actionWithRpcCalls

Conversation

@vncoelho

Copy link
Copy Markdown
Member

The idea here is to add calls for RPCServer and other plugins in the future, making this integration tests for neo-node to test different plugins functionalities.

For now it can be enabled always. In the future we can trigger it on specific moments if it starts to become a problem.

@github-actions github-actions Bot added the N3 label Mar 18, 2026
@vncoelho

Copy link
Copy Markdown
Member Author

I plan to add new calls to RPCSever if we are moving this forward, maybe even diagnostic for genesis block, something like that.

I believe it is a good way to ensure that key neo-node essential tools are working properly.

@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.73%. Comparing base (390a76b) to head (43af02d).
⚠️ Report is 1 commits behind head on master-n3.

Additional details and impacted files
@@            Coverage Diff             @@
##           master-n3    #1016   +/-   ##
==========================================
  Coverage      43.73%   43.73%           
==========================================
  Files            274      274           
  Lines          15682    15682           
  Branches        1959     1959           
==========================================
  Hits            6859     6859           
  Misses          8461     8461           
  Partials         362      362           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vncoelho vncoelho marked this pull request as draft March 18, 2026 13:54
@ajara87 ajara87 requested a review from Copilot March 22, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a lightweight RPC-level integration check to the CI pipeline to validate that neo-cli starts correctly with plugins and that basic RpcServer JSON-RPC methods behave as expected.

Changes:

  • Add a bash script that issues a small set of JSON-RPC calls (getversion, getbestblockhash, getblockcount, listplugins) and validates response shapes.
  • Update the GitHub Actions workflow to install jq, start neo-cli in the background, run the RPC script, and then stop the process.
  • Add jq to the devcontainer image to support running the same checks in development environments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/test-rpc-calls.sh New script that performs and validates several JSON-RPC calls against a local RPC endpoint.
.github/workflows/main.yml CI job updates to install jq, start/stop neo-cli, and execute the RPC test script.
.devcontainer/Dockerfile Adds jq to the devcontainer dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/main.yml Outdated
Comment on lines +10 to +21
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "getversion"}' $RPC_URL)
if [[ $? -ne 0 ]]; then
echo "Failed to call getversion"
exit 1
fi
echo "getversion response: $response"

# Check if response contains expected fields
if ! echo "$response" | jq -e '.result.tcpport' > /dev/null; then
echo "getversion response missing tcpport"
exit 1
fi

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script only checks curl's exit code, but JSON-RPC failures typically come back as HTTP 200 with an .error object (curl still exits 0). This can lead to misleading failures (or passing checks against an empty/incorrect .result). Consider asserting .error == null (and .result exists) for each call before validating fields like .result.tcpport.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +25
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "getversion"}' $RPC_URL)
if [[ $? -ne 0 ]]; then
echo "Failed to call getversion"
exit 1
fi
echo "getversion response: $response"

# Check if response contains expected fields
if ! echo "$response" | jq -e '.result.tcpport' > /dev/null; then
echo "getversion response missing tcpport"
exit 1
fi

# Test 2: getbestblockhash
echo "Testing getbestblockhash..."
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 2, "method": "getbestblockhash"}' $RPC_URL)

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All curl invocations use -s without timeouts/retries. If the node is slow to start or the port is unreachable, the job can hang for a long time and/or fail flakily. Consider adding -sS plus bounded timeouts (e.g., connect/max time) and retry/poll logic (or a dedicated readiness loop before the tests).

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +12
# Test 1: getversion
echo "Testing getversion..."
response=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "getversion"}' $RPC_URL)
if [[ $? -ne 0 ]]; then
echo "Failed to call getversion"

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of repeated curl + jq boilerplate across the individual RPC tests, which will make it harder to extend this script with more plugin RPC checks later. Consider introducing a small helper function (e.g., rpc_call method id) that performs the POST + .error/.result validation once and returns the parsed JSON for method-specific assertions.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/main.yml Outdated
vncoelho and others added 2 commits June 15, 2026 20:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants