Skip to content

Commit

Permalink
Update plugin.py (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jupe authored Mar 10, 2020
1 parent c6895a5 commit d767b75
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions robot_opentmi/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ def end_test(self, data, _result):
logger.debug('end_test')

result = Result(tcid=data.longname)
result.campaign = data.parent.longname
result.campaign = os.environ.get('JOB_NAME', data.parent.longname)
if _result.message:
result.execution.note = _result.message
result.execution.duration = float(_result.elapsedtime)
result.execution.environment.framework.name = __robot_info__.project_name
result.execution.environment.framework.version = __robot_info__.version
result.job.id = os.environ.get('JOB_NAME', str(uuid.uuid1()))
result.execution.sut.commit_id = os.environ.get('GIT_COMMIT', "")
result.execution.sut.branch = os.environ.get('GIT_BRANCH ', "")
result.job.id = os.environ.get('BUILD_TAG', str(uuid.uuid1()))
try:
result.execution.verdict = _result.status.lower()
except Exception as error: # pylint: disable=broad-except
Expand All @@ -83,6 +85,9 @@ def end_test(self, data, _result):
value = self._variables[key]

if ['LOG_FILE', 'OUTPUT_FILE', 'REPORT_FILE'].__contains__(key):
if not os.path.exists(value):
logger.debug(f"{key} file {value} not exists")
continue
file_stats = os.stat(value)
if file_stats.st_size / (1024 * 1024) > 1.0:
logger.debug('avoid uploading huge log files')
Expand Down

0 comments on commit d767b75

Please sign in to comment.