Skip to content

Commit 189a93c

Browse files
authored
Add transport type as list (#108)
1 parent ee8418e commit 189a93c

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

integration/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Launch an automated test sequence on Silkworm RpcDaemon (aka Silkrpc) or Erigon
5050
-s,--start-from-test: <test_number>: run tests starting from input
5151
-t,--run-single-test: <test_number>: run single test
5252
-d,--compare-erigon-rpcdaemon: send requests also to the reference daemon e.g.: Erigon RpcDaemon
53-
-T,--transport_type: http or websocket or both
53+
-T,--transport_type: <http,websocket>
5454
-k,--jwt: authentication token file
5555
-a,--api-list: <apis>: run all tests of the specified API (e.g.: eth_call,eth_getLogs,debug_)
5656
-x,--exclude-api-list: exclude API list (e.g.: txpool_content,txpool_status,engine_)

integration/run_tests.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def usage(argv):
140140
print("-s,--start-from-test: <test_number>: run tests starting from input")
141141
print("-t,--run-single-test: <test_number>: run single test")
142142
print("-d,--compare-erigon-rpcdaemon: send requests also to the reference daemon e.g.: Erigon RpcDaemon")
143-
print("-T,--transport_type: http or websocket or both")
143+
print("-T,--transport_type: <http,websocket>")
144144
print("-k,--jwt: authentication token file")
145145
print("-a,--api-list: <apis>: run all tests of the specified API (e.g.: eth_call,eth_getLogs,debug_)")
146146
print("-x,--exclude-api-list: exclude API list (e.g.: txpool_content,txpool_status,engine_)")
@@ -431,10 +431,17 @@ def select_user_options(self, argv):
431431
elif option in ("-o", "--dump-response"):
432432
self.force_dump_jsons = 1
433433
elif option in ("-T", "--transport_type"):
434-
if optarg not in ('http', 'websocket', 'both'):
435-
print("Error in options: -T/--transport_type http or websocket or both")
434+
if optarg == "":
435+
print("Error in options: -T/--transport_type http,websocket")
436436
usage(argv)
437437
sys.exit(1)
438+
tokenize_list = optarg.split(",")
439+
for test in tokenize_list:
440+
if test not in ['websocket','http']:
441+
print("Error invalid connection type: ",test)
442+
print("Error in options: -T/--transport_type http,websocket")
443+
usage(argv)
444+
sys.exit(1)
438445
self.transport_type = optarg
439446
elif option in ("-b", "--blockchain"):
440447
self.net = optarg
@@ -553,7 +560,9 @@ def execute_request(transport_type: str, jwt_auth, encoded, request_dumps, targe
553560
sys.exit(1)
554561

555562
if verbose_level > 1:
556-
print ("\nResponse.len:",len(result))
563+
print ("\n",target)
564+
print (request_dumps)
565+
print ("Response.len:",len(result))
557566
return result
558567

559568

@@ -787,14 +796,11 @@ def main(argv) -> int:
787796
success_tests = 0
788797
tests_not_executed = 0
789798
global_test_number = 1
790-
if config.transport_type == "websocket":
791-
curr_transport_type = "webs"
792-
else:
793-
curr_transport_type = "http"
794799
for test_rep in range(0, config.loop_number): # makes tests more times
795800
if config.verbose_level:
796801
print("Test iteration: ", test_rep + 1)
797-
for channel_type in range (1,3):
802+
tokenize_transport_type = config.transport_type.split(",")
803+
for transport_type in tokenize_transport_type:
798804
dirs = sorted(os.listdir(config.json_dir))
799805
for api_name in dirs: # scans all api present in dir
800806
# jump results folder or any hidden OS-specific folder
@@ -827,7 +833,7 @@ def main(argv) -> int:
827833
if (config.start_test == "" or # start from specific test
828834
(config.start_test != "" and global_test_number >= int(config.start_test))):
829835
file = test_file.ljust(60)
830-
curr_tt = curr_transport_type.ljust(4)
836+
curr_tt = transport_type.ljust(8)
831837
if config.verbose_level:
832838
print(f"{global_test_number:03d}. {curr_tt}::{file} ", end='', flush=True)
833839
else:
@@ -841,7 +847,7 @@ def main(argv) -> int:
841847
config.external_provider_url,
842848
config.daemon_on_host, config.daemon_on_port,
843849
config.jwt_secret,
844-
curr_transport_type,
850+
transport_type,
845851
config.without_compare_results,
846852
config.compression)
847853
if ret == 1:
@@ -854,10 +860,6 @@ def main(argv) -> int:
854860

855861
global_test_number = global_test_number + 1
856862
test_number = test_number + 1
857-
if config.transport_type == "both":
858-
curr_transport_type = "webs"
859-
continue
860-
break
861863

862864
if (config.req_test_number != -1 or config.testing_apis != "") and match == 0:
863865
print("ERROR: api or testNumber not found")

0 commit comments

Comments
 (0)