@@ -112,7 +112,16 @@ def log_error(error, node_name, step='unknown', remote_node=None):
112112 else :
113113 key = f"{ step } — { type (error ).__name__ } : { error_message } "
114114
115- # Store errors in a temporary file to ensure persistence across test session
115+ # Store errors in the global error_stats for this node
116+ if node_name not in error_stats :
117+ error_stats [node_name ] = {}
118+
119+ if key in error_stats [node_name ]:
120+ error_stats [node_name ][key ] += 1
121+ else :
122+ error_stats [node_name ][key ] = 1
123+
124+ # Also store in a temporary file to ensure persistence across test session
116125 error_file = "test_output/error_stats.json"
117126 os .makedirs ("test_output" , exist_ok = True )
118127
@@ -164,7 +173,7 @@ def run_test_for_node(node, index):
164173 publish_times , query_times , local_get_times , remote_get_times = [], [], [], []
165174 failed_assets = []
166175
167- for i in range (10 ):
176+ for i in range (1 ):
168177 print (f"\n 📡 Publishing KA #{ i + 1 } on { name } " )
169178 content = get_random_content (name )
170179 ual = None
@@ -273,8 +282,21 @@ def avg(times): return round(sum(times) / len(times), 2) if times else 0.0
273282 os .makedirs ("test_output" , exist_ok = True )
274283 with open (f"test_output/summary_{ name .replace (' ' , '_' )} .json" , "w" ) as f :
275284 json .dump (summary , f , indent = 2 )
285+
286+ # Write error file by merging with existing errors from the aggregated file
287+ error_file = "test_output/error_stats.json"
288+ if os .path .exists (error_file ):
289+ with open (error_file , 'r' ) as f :
290+ try :
291+ all_errors = json .load (f )
292+ node_errors = all_errors .get (name , {})
293+ except :
294+ node_errors = {}
295+ else :
296+ node_errors = {}
297+
276298 with open (f"test_output/errors_{ name .replace (' ' , '_' )} .json" , "w" ) as f :
277- json .dump (error_stats . get ( name , {}) , f , indent = 2 )
299+ json .dump (node_errors , f , indent = 2 )
278300
279301 print (f"\n ──────────── Summary for { name } ────────────" )
280302 if failed_assets :
0 commit comments