1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

chore: Recognize exit status in regression tests (#2571)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-02-12 09:03:56 +02:00 committed by GitHub
parent 8ead569b2f
commit 24fcf8d883
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@ import aiohttp
import logging
from dataclasses import dataclass
from typing import Dict, Optional, List, Union
import os
import re
import psutil
import itertools
@ -162,6 +163,15 @@ class DflyInstance:
if proc is None:
return
# if we have log files, it means that we started a process.
# if it died before we could stop it, we should raise an exception
if self.log_files:
exitcode = proc.poll()
if exitcode is not None:
if exitcode != 0:
raise Exception(f"Process exited with code {exitcode}")
return
logging.debug(f"Stopping instance on {self._port}")
try:
if kill:
@ -193,9 +203,11 @@ class DflyInstance:
self._port = None
all_args = self.format_args(self.args)
logging.debug(f"Starting instance with arguments {all_args} from {self.params.path}")
arg_str = " ".join(all_args)
bin_path = os.path.realpath(self.params.path)
logging.debug(f"Starting {bin_path} with arguments: {arg_str}")
run_cmd = [self.params.path, *all_args]
run_cmd = [bin_path, *all_args]
if self.params.gdb:
run_cmd = ["gdb", "--ex", "r", "--args"] + run_cmd
@ -319,7 +331,7 @@ class DflyInstanceFactory:
args = {**self.args, **kwargs}
args.setdefault("dbfilename", "")
vmod = "dragonfly_connection=1,accept_server=1,listener_interface=1,main_service=1,rdb_save=1,replica=1"
# args.setdefault("vmodule", vmod)
args.setdefault("vmodule", vmod)
for k, v in args.items():
args[k] = v.format(**self.params.env) if isinstance(v, str) else v