Skip to content

Commit

Permalink
Merge pull request #5459 from andrwng/installer
Browse files Browse the repository at this point in the history
tests: re-use installs in upgrade tests
  • Loading branch information
andrwng committed Jul 15, 2022
2 parents 63e819b + 54f650e commit df45155
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 108 deletions.
1 change: 1 addition & 0 deletions tests/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ services:
- minio
volumes:
- '${BUILD_ROOT}:${BUILD_ROOT}'
- '${BUILD_ROOT}/redpanda_installs:/opt/redpanda_installs'
networks:
- redpanda-test
24 changes: 13 additions & 11 deletions tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ def __init__(self,
environment: Optional[dict[str, str]] = None,
security: SecurityConfig = SecurityConfig(),
node_ready_timeout_s=None,
enable_installer=False,
superuser: Optional[SaslCredentials] = None):
super(RedpandaService, self).__init__(context, num_nodes=num_brokers)
self._context = context
Expand All @@ -467,9 +466,7 @@ def __init__(self,
self._enable_pp = enable_pp
self._enable_sr = enable_sr
self._security = security
self._installer: Optional[RedpandaInstaller] = None
if enable_installer:
self._installer = RedpandaInstaller(self)
self._installer: RedpandaInstaller = RedpandaInstaller(self)

if superuser is None:
superuser = self.SUPERUSER_CREDENTIALS
Expand Down Expand Up @@ -621,7 +618,7 @@ def start(self, nodes=None, clean_nodes=True, start_si=True):
# Expected usage is that we may install new binaries before
# starting the cluster, and installation-cleaning happened
# when we started the installer.
self.clean_node(node, clean_installs=False)
self.clean_node(node, preserve_current_install=True)
else:
self.logger.debug("%s: skip cleaning node" %
self.who_am_i(node))
Expand Down Expand Up @@ -1154,7 +1151,7 @@ def decode_backtraces(self):
self.logger.exception("Failed to run seastar-addr2line")

def rp_install_path(self):
if self._installer and self._installer._started:
if self._installer._started:
# The installer sets up binaries to always use /opt/redpanda.
return "/opt/redpanda"
return self._context.globals.get("rp_install_path_root", None)
Expand Down Expand Up @@ -1227,7 +1224,10 @@ def clean(self, **kwargs):
if self._s3client:
self.delete_bucket_from_si()

def clean_node(self, node, preserve_logs=False, clean_installs=True):
def clean_node(self,
node,
preserve_logs=False,
preserve_current_install=False):
# These are allow_fail=True to allow for a race where kill_process finds
# the PID, but then the process has died before it sends the SIGKILL. This
# should be safe against actual failures to of the process to stop, because
Expand Down Expand Up @@ -1255,9 +1255,11 @@ def clean_node(self, node, preserve_logs=False, clean_installs=True):
self.EXECUTABLE_SAVE_PATH):
node.account.remove(self.EXECUTABLE_SAVE_PATH)

if clean_installs and self._installer is not None:
# Get rid of any installed packages.
self._installer.clean(node)
if not preserve_current_install or not self._installer._started:
# Reset the binaries to use the original binaries.
# NOTE: if the installer hasn't been started, there is no
# installation to preserve!
self._installer.reset_current_install([node])

def remove_local_data(self, node):
node.account.remove(f"{RedpandaService.PERSISTENT_ROOT}/data/*")
Expand Down Expand Up @@ -1752,7 +1754,7 @@ def save_executable(self):
# Any node will do. Even in a mixed-version upgrade test, we should
# still have the original binaries available.
node = self.nodes[0]
if self._installer and self._installer._started:
if self._installer._started:
head_root_path = self._installer.path_for_version(
RedpandaInstaller.HEAD)
binary = f"{head_root_path}/libexec/redpanda"
Expand Down
Loading

0 comments on commit df45155

Please sign in to comment.