mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Check unexpected exceptions in Patroni logs after behave (#2538)
and make behave fail if there are anything unexpected found. In addition to that fix globing rule when uploading artifacts with logs.
This commit is contained in:
@@ -144,7 +144,7 @@ jobs:
|
|||||||
name: behave-${{ matrix.os }}-${{ matrix.dcs }}-${{ matrix.python-version }}-logs
|
name: behave-${{ matrix.os }}-${{ matrix.dcs }}-${{ matrix.python-version }}-logs
|
||||||
path: |
|
path: |
|
||||||
features/output/*_failed/*postgres?.*
|
features/output/*_failed/*postgres?.*
|
||||||
features/output/*
|
features/output/*.log
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
- name: Generate coverage xml report
|
- name: Generate coverage xml report
|
||||||
|
|||||||
+14
-1
@@ -1,5 +1,6 @@
|
|||||||
import abc
|
import abc
|
||||||
import datetime
|
import datetime
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import psutil
|
import psutil
|
||||||
@@ -1110,8 +1111,20 @@ def after_feature(context, feature):
|
|||||||
if os.path.exists(data):
|
if os.path.exists(data):
|
||||||
shutil.rmtree(data)
|
shutil.rmtree(data)
|
||||||
context.dcs_ctl.cleanup_service_tree()
|
context.dcs_ctl.cleanup_service_tree()
|
||||||
if feature.status == 'failed':
|
|
||||||
|
found = False
|
||||||
|
logs = glob.glob(context.pctl.output_dir + '/patroni_*.log')
|
||||||
|
for log in logs:
|
||||||
|
with open(log) as f:
|
||||||
|
for line in f:
|
||||||
|
if 'please report it as a BUG' in line:
|
||||||
|
print(':'.join([log, line.rstrip()]))
|
||||||
|
found = True
|
||||||
|
|
||||||
|
if feature.status == 'failed' or found:
|
||||||
shutil.copytree(context.pctl.output_dir, context.pctl.output_dir + '_failed')
|
shutil.copytree(context.pctl.output_dir, context.pctl.output_dir + '_failed')
|
||||||
|
if found:
|
||||||
|
raise Exception('Unexpected errors in Patroni log files')
|
||||||
|
|
||||||
|
|
||||||
def before_scenario(context, scenario):
|
def before_scenario(context, scenario):
|
||||||
|
|||||||
Reference in New Issue
Block a user