Skip to content

Commit

Permalink
Give the installer more time to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Sep 26, 2024
1 parent de4d06d commit 62676c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 13 additions & 3 deletions tests/pytests/pkg/downgrade/test_salt_downgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,19 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):

time.sleep(10) # give it some time
# downgrade install will stop services on Debian/Ubuntu
# This is due to RedHat systems are not active after an install, but Debian/Ubuntu are active after an install
# want to ensure our tests start with the config settings we have set,
# This is due to RedHat systems are not active after an install, but
# Debian/Ubuntu are active after an install
# Want to ensure our tests start with the config settings we have set,
# trying restart for Debian/Ubuntu to see the outcome
if install_salt.distro_id in ("ubuntu", "debian"):
install_salt.restart_services()

time.sleep(60) # give it some time
# Give it some time
if platform.is_windows():
# Windows needs more time
time.sleep(300)
else:
time.sleep(60)

# Verify there is a new running minion by getting its PID and comparing it
# with the PID from before the upgrade
Expand All @@ -102,6 +108,10 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):
else:
bin_file = install_salt.install_dir / "salt-call.exe"

# Is the binary present
assert bin_file.is_file()

# Is it the right version
ret = install_salt.proc.run(bin_file, "--version")
assert ret.returncode == 0
assert packaging.version.parse(
Expand Down
5 changes: 2 additions & 3 deletions tests/support/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def salt_factories_root_dir(system_service: bool = False) -> pathlib.Path:
if system_service is False:
return None
if platform.is_windows():
# TODO: This needs to be C:\ProgramData\Salt Project\Salt
return pathlib.Path("C:\\salt")
if platform.is_darwin():
return pathlib.Path("/opt/salt")
Expand Down Expand Up @@ -449,9 +450,7 @@ def _install_pkgs(self, upgrade=False, downgrade=False):
log.debug("Installing: %s", str(pkg))
# ret = self.proc.run("start", "/wait", f"\"{str(pkg)} /start-minion=0 /S\"")
batch_file = pathlib.Path(pkg).parent / "install_nsis.cmd"
batch_content = f"start /wait {str(pkg)} /start-minion=0 /S"
with salt.utils.files.fopen(batch_file, "w") as fp:
fp.write(batch_content)
batch_file.write_text(f'start /wait "" "{str(pkg)}" /start-minion=0 /S')
# Now run the batch file
ret = self.proc.run("cmd.exe", "/c", str(batch_file))
self._check_retcode(ret)
Expand Down

0 comments on commit 62676c1

Please sign in to comment.