Increased sleep time to download the Allure results after run tests & add more logs to environment properties

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
Jitendrakumar Kushavah
2024-05-27 15:22:58 +05:30
committed by GitHub
parent f3cf8d9968
commit f2e9b516d3
3 changed files with 19 additions and 1 deletions

View File

@@ -92,7 +92,7 @@ runs:
pytest -m "${{ inputs.marker_expression }}" -s -vvv --testbed=${{ inputs.testbed }} --alluredir=/tmp/allure-results ${{ inputs.additional_args }}
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
sleep 180
exit \$ret
volumeMounts:
- name: configuration

View File

@@ -766,6 +766,7 @@ class tip_2x:
def setup_environment_properties(self, add_allure_environment_property=None):
if add_allure_environment_property is None:
logging.info("add_allure_environment_property is None" + str(add_allure_environment_property))
return
add_allure_environment_property('Cloud-Controller-SDK-URL', self.controller_data.get("url"))
sdk_version_data = self.get_controller_version()
@@ -773,6 +774,7 @@ class tip_2x:
add_allure_environment_property(microservice + '-version',
str(sdk_version_data.get(microservice)))
dut_versions = self.get_dut_version()
logging.info("setup_environment_properties dut_versions:- " + str(dut_versions))
for i in range(len(self.device_under_tests_info)):
add_allure_environment_property("Firmware-Version_" + self.device_under_tests_info[i]["identifier"],
str(dut_versions[i]))
@@ -784,6 +786,7 @@ class tip_2x:
identifiers.append(dut["identifier"])
add_allure_environment_property('DUT-Model/s', ", ".join(models))
add_allure_environment_property('Serial-Number/s', ", ".join(identifiers))
logging.info("setup_environment_properties:- " + str(add_allure_environment_property))
def setup_firmware(self):
# Query AP Firmware

View File

@@ -6,6 +6,8 @@ import string
import sys
import random
import datetime
import time
import allure
import pytest
import json
@@ -454,13 +456,25 @@ def add_allure_environment_property(request: SubRequest) -> Optional[Callable]:
alluredir = request.config.getoption(ALLUREDIR_OPTION)
if not alluredir or not os.path.isdir(alluredir) or not environment_properties:
logging.info("alluredir:- " + str(alluredir))
logging.info("os.path.isdir(alluredir):- " + str(os.path.isdir(alluredir)))
logging.info("environment_properties:- " + str(environment_properties))
return
allure_env_path = os.path.join(alluredir, ALLURE_ENVIRONMENT_PROPERTIES_FILE)
print("allure_env_path:- ", allure_env_path)
with open(allure_env_path, 'w') as _f:
data = '\n'.join([f'{variable}={value}' for variable, value in environment_properties.items()])
logging.info("allure_env_path data:- " + str(data))
_f.write(data)
time.sleep(2)
# Check environment.properties file available or not
print("Checking environment.properties file available or not")
if os.path.isfile(allure_env_path):
logging.info(f"The file '{allure_env_path}' is available.")
else:
logging.info(f"The file '{allure_env_path}' is not available.")
@pytest.fixture(scope="function")
@@ -518,6 +532,7 @@ def get_test_device_logs(request, get_testbed_details, get_target_object, skip_l
@pytest.fixture(scope="session")
def add_firmware_property_after_upgrade(add_allure_environment_property, get_testbed_details, get_target_object):
dut_versions = get_target_object.get_dut_version()
logging.info("After firmware upgrade DUT versions:- " + str(dut_versions))
for i in range(len(get_testbed_details["device_under_tests"])):
add_allure_environment_property(
"Firmware-Version_" + get_testbed_details["device_under_tests"][i]["identifier"],