Skip to content

Commit

Permalink
Merge pull request #99 from arangodb/bug-fix/fix-system-error-handling2
Browse files Browse the repository at this point in the history
suppress certain warning, and even more for system instances
  • Loading branch information
dothebart committed May 11, 2021
2 parents 805d239 + fd1b3cd commit e94df6e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
6 changes: 4 additions & 2 deletions release_tester/arangodb/installers/base.py
Expand Up @@ -274,7 +274,8 @@ def load_config(self):
self.cfg.localhost,
self.cfg.publicip,
self.cfg.log_dir,
self.cfg.passvoid)
self.cfg.passvoid,
True)
self.calculate_package_names()
self.cfg.verbose = verbose

Expand Down Expand Up @@ -437,4 +438,5 @@ def set_system_instance(self):
self.cfg.publicip,
(self.cfg.installPrefix /
self.cfg.log_dir),
self.cfg.passvoid)
self.cfg.passvoid,
True)
29 changes: 20 additions & 9 deletions release_tester/arangodb/instance.py
Expand Up @@ -22,7 +22,7 @@
]

# log tokens we ignore in system ugprades...
LOG_PACKAGE_BLACKLIST = [
LOG_SYSTEM_BLACKLIST = [
"40e37" # -> upgrade required
]
class InstanceType(IntEnum):
Expand Down Expand Up @@ -58,6 +58,7 @@ class Instance(ABC):
# pylint: disable=R0913 disable=R0902
def __init__(self, typ, port, basedir, localhost, publicip, passvoid, logfile):
self.type = InstanceType[typ] # convert to enum
self.is_system = False
self.type_str = TYP_STRINGS[int(self.type.value)]
self.port = port
self.pid = None
Expand Down Expand Up @@ -124,6 +125,17 @@ def get_endpoint(self):
""" arangodb enpoint - to be specialized (if) """
raise Exception("this instance doesn't support endpoints." + repr(self))

def is_suppressed_log_line(self, line):
""" check whether this is one of the errors we can ignore """
for blacklist_item in LOG_BLACKLIST:
if blacklist_item in line:
return True
if self.is_system:
for blacklist_item in LOG_SYSTEM_BLACKLIST:
if blacklist_item in line:
return True
return False

def search_for_warnings(self):
""" browse our logfile for warnings and errors """
if not self.logfile.exists():
Expand All @@ -137,26 +149,25 @@ def search_for_warnings(self):
"ERROR" in line or
"WARNING" in line or
"{crash}" in line):
skip = False
for blacklist_item in LOG_BLACKLIST:
if blacklist_item in line:
skip = True
count += 1
print(line.rstrip())
if self.is_suppressed_log_line(line):
count += 1
else:
print(line.rstrip())
if count > 0:
print(" %d lines suppressed by filters" % count)

class ArangodInstance(Instance):
""" represent one arangodb instance """
# pylint: disable=R0913
def __init__(self, typ, port, localhost, publicip, basedir, passvoid):
def __init__(self, typ, port, localhost, publicip, basedir, passvoid, is_system=False):
super().__init__(typ,
port,
basedir,
localhost,
publicip,
passvoid,
basedir / 'arangod.log')
self.is_system = is_system

def __repr__(self):
return """
Expand Down Expand Up @@ -337,7 +348,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""):
if line == "":
time.sleep(1)
continue
if "] FATAL [" in line:
if "] FATAL [" in line and not self.is_suppressed_log_line(line):
print('Error: ', line)
raise Exception("FATAL error found in arangod.log: " + line)
# save last line and append to string
Expand Down
3 changes: 3 additions & 0 deletions release_tester/arangodb/starter/deployments/runner.py
Expand Up @@ -121,6 +121,7 @@ def __init__(
self.selenium = init_selenium(runner_type, selenium_worker, selenium_driver_args)

def progress(self, is_sub, msg, separator='x'):
""" report user message, record for error handling. """
if self.state:
self.state += "\n"
if self.selenium:
Expand All @@ -137,9 +138,11 @@ def progress(self, is_sub, msg, separator='x'):
self.state += "*** " + msg

def get_progress(self):
""" get user message reports """
return self.state

def take_screenshot(self):
""" if we are a selenium enabled run, take a screenshot with the browser. """
if self.selenium:
self.selenium.take_screenshot()

Expand Down
5 changes: 3 additions & 2 deletions release_tester/full_download_upgrade_test.py
Expand Up @@ -64,15 +64,16 @@ def upgrade_package_test(verbose,
old_version_content = old_version_state.read_text()
if new_version_state.exists():
new_version_content = new_version_state.read_text()

fresh_old_content = dl_old.get_version_info(dlstage, git_version)
fresh_new_content = dl_new.get_version_info(dlstage, git_version)
old_changed = old_version_content != fresh_old_content
new_changed = new_version_content != fresh_new_content

if new_changed and old_changed and not force:
print("we already tested this version. bye.")
return 0

dl_old.get_packages(old_changed, dlstage)
dl_new.get_packages(new_changed, dlstage)

Expand Down

0 comments on commit e94df6e

Please sign in to comment.