Skip to content

Commit

Permalink
[ASSET-50] Log public IP when RPC Test failure (#56)
Browse files Browse the repository at this point in the history
* ASSET-50 Add public IP log on RPC failure

Signed-off-by: jormal <[email protected]>

* ASSET-50 Update CI test to verbose print

Signed-off-by: jormal <[email protected]>

* ASSET-50 Fix the action runs on self-hosted machine

Signed-off-by: jormal <[email protected]>

---------

Signed-off-by: jormal <[email protected]>
  • Loading branch information
jormal authored Jan 22, 2025
1 parent 2cf8c50 commit a100a81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- name: Checkout code
Expand All @@ -27,4 +27,4 @@ jobs:
run: pip install -e ".[test]"

- name: Test
run: pytest -l
run: pytest -l -vv
7 changes: 6 additions & 1 deletion tests/additional/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from re import search

import pytest
import requests
from git import Repo
from pydantic import HttpUrl
from web3 import Web3, HTTPProvider
Expand Down Expand Up @@ -61,7 +62,11 @@ async def __test_rpc_url(self, network: Network):
if node_url := self.rpc_map.get(network.id, None):
if network.engine.is_evm:
node = Web3(HTTPProvider(node_url))
assert node.is_connected(), f"The node ${network.id} is not connected."
if not node.is_connected():
public_ip = requests.get("https://api.ipify.org").text
assert (
node.is_connected()
), f"The node ${network.id} is not connected. (Public IP: ${public_ip})"
assert node.eth.chain_id == int(
str(network.id).removeprefix("evm-")
), "The chain ID ${node.eth.chain_id} does not match the network ID ${network.id}."
Expand Down

0 comments on commit a100a81

Please sign in to comment.