mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-10-31 02:48:11 +00:00 
			
		
		
		
	Added pretty print in the reboot logs and device statistics (#1006)
* Added Pretty-Print allure attachment for device statistics and reboot logs Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> * Added return code in pytest exit Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> * Modified pytest exit msg for the crash Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> * Added try and except for crash logs logic Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> * Modified pytest exit code Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> * Removed return code from pytest exit Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com> --------- Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
		 Jitendrakumar Kushavah
					Jitendrakumar Kushavah
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							7e53c6c65e
						
					
				
				
					commit
					6fdc392dbb
				
			| @@ -521,22 +521,25 @@ def get_dut_logs_per_test_case(request, run_lf, get_testbed_details, get_target_ | ||||
|                 query_ = f"?startDate={start_time}&endDate={end_time}" | ||||
|                 resp = get_target_object.controller_library_object.get_device_statistics_teardown(device_name, query=query_) | ||||
|                 if resp.status_code == 200: | ||||
|                     allure.attach(body=str(resp.json()), name="device_statistics_per_test_case") | ||||
|                     allure.attach(body=json.dumps(resp.json(), indent=4), name="device_statistics_per_test_case\n", | ||||
|                                                   attachment_type=allure.attachment_type.JSON) | ||||
|                 else: | ||||
|                     logging.info("resp.status_code:- " + str(resp.status_code)) | ||||
|                 # Check reboot logs | ||||
|                 query_ = f"?logType=2&startDate={start_time}&endDate={end_time}" | ||||
|                 resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, query=query_) | ||||
|                 if resp.status_code == 200: | ||||
|                     allure.attach(body=str(resp.json()), name="device_reboot_logs_per_test_case") | ||||
|                     allure.attach(body=json.dumps(resp.json(), indent=4), name="device_reboot_logs_per_test_case\n", | ||||
|                                   attachment_type=allure.attachment_type.JSON) | ||||
|                     response = resp.json() | ||||
|                     # crash log validation | ||||
|                     if response["values"]: | ||||
|                         resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, | ||||
|                                                                                                   query="?logType=2") | ||||
|                         allure.attach(body=str(resp.json()), name="all_device_reboot_logs") | ||||
|                         logging.info("Reboot detected on AP side") | ||||
|                         pytest.exit("Reboot detected on AP side") | ||||
|                         allure.attach(body=json.dumps(resp.json(), indent=4), name="all_device_reboot_logs\n", | ||||
|                                       attachment_type=allure.attachment_type.JSON) | ||||
|                         logging.info("AP crashed during the test") | ||||
|                         pytest.exit("AP crashed during the test") | ||||
|                 else: | ||||
|                     logging.info("resp.status_code:- " + str(resp.status_code)) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user