You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What’s the best way to spin up a container that can connect to a dedicated RPC endpoint requiring an API key, and then test it through Docker?
import subprocess
def run_flood_test(node_name, node_url, api_key=None):
"""
Run a flood test on the specified RPC endpoint.
:param node_name: Name of the node for identification in reports.
:param node_url: URL of the RPC endpoint.
:param api_key: (Optional) API key for the RPC endpoint.
"""
# If API key is provided, append it to the URL as a query param
if api_key:
# You might need to handle existing query params more robustly
node_url = f"{node_url}?x-api-key={api_key}"
# Construct flood command
command = [
'docker', 'run', '--rm',
'ghcr.io/paradigmxyz/flood:latest',
'eth_getBlockByNumber',
f'{node_name}={node_url}',
'--rates', '10', '100', '1000',
'--duration', '5'
]
try:
result = subprocess.run(command, capture_output=True, text=True, check=True)
print("Command Output:")
print(result.stdout)
except subprocess.CalledProcessError as e:
print("Error Occurred:")
print(e.stderr)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
What’s the best way to spin up a container that can connect to a dedicated RPC endpoint requiring an API key, and then test it through Docker?
Beta Was this translation helpful? Give feedback.
All reactions