Skip to content
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

Add possibility to filter equality tests based on RegExp #52

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ Instead of testing the raw performance of an RPC node, `flood` can be used to te

`flood all reth=91.91.91.91 erigon=92.92.92.92 --equality`

There is a possibility to run only specific test or a subset of tests using regular expression like this:

`flood debug_* reth=91.91.91.91 erigon=92.92.92.92 --equality`

Above will run all the test scenarios which contain prefix "debug_".

### From python

All of `flood`'s functionality can be used from python instead of the CLI. Some functions:
Expand Down
4 changes: 3 additions & 1 deletion flood/tests/equality_tests/equality_test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def run_equality_test(
import os
import requests
import toolstr
import re

nodes = flood.user_io.parse_nodes(nodes, request_metadata=True)
for node in nodes.values():
Expand All @@ -30,7 +31,8 @@ def run_equality_test(

# get tests
if test_name != 'all':
equality_tests = [t for t in equality_tests if t[0] == test_name]
pattern = f"^{test_name}" # Creates a regex pattern starting with test_name
equality_tests = [t for t in equality_tests if re.match(pattern, t[0])]
if not equality_tests:
raise NotImplementedError(
'no matching test found for name "' + test_name + '"'
Expand Down