Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Recognize exit status in regression tests #2571

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions tests/dragonfly/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
from dataclasses import dataclass
from typing import Dict, Optional, List, Union
import os
import re
import psutil
import itertools
Expand Down Expand Up @@ -162,6 +163,15 @@ def stop(self, kill=False):
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:
Expand Down Expand Up @@ -193,9 +203,11 @@ def _start(self):
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

Expand Down Expand Up @@ -319,7 +331,7 @@ def create(self, existing_port=None, **kwargs) -> DflyInstance:
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
Expand Down
Loading