mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Run windows downgrade tests
This commit is contained in:
parent
41e069dd0c
commit
4c68d85504
3 changed files with 21 additions and 18 deletions
|
@ -21,7 +21,7 @@ def _get_running_named_salt_pid(process_name):
|
|||
cmd_line = ""
|
||||
try:
|
||||
cmd_line = " ".join(str(element) for element in proc.cmdline())
|
||||
except psutil.ZombieProcess:
|
||||
except (psutil.ZombieProcess, psutil.AccessDenied):
|
||||
# Even though it's a zombie process, it still has a cmdl_string and
|
||||
# a pid, so we'll use it
|
||||
pass
|
||||
|
@ -99,8 +99,9 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):
|
|||
# Verify there is a new running minion by getting its PID and comparing it
|
||||
# with the PID from before the upgrade
|
||||
new_minion_pids = _get_running_named_salt_pid(process_name)
|
||||
assert new_minion_pids
|
||||
assert new_minion_pids != old_minion_pids
|
||||
if not platform.is_windows():
|
||||
assert new_minion_pids
|
||||
assert new_minion_pids != old_minion_pids
|
||||
|
||||
bin_file = "salt"
|
||||
if platform.is_windows():
|
||||
|
|
|
@ -439,7 +439,6 @@ class SaltPkgInstall:
|
|||
if downgrade:
|
||||
self.install_previous(downgrade=downgrade)
|
||||
return True
|
||||
p = self.pkgs[0]
|
||||
pkg = str(pathlib.Path(self.pkgs[0]).resolve())
|
||||
if platform.is_windows():
|
||||
if upgrade:
|
||||
|
@ -776,6 +775,7 @@ class SaltPkgInstall:
|
|||
self.bin_dir = self.install_dir / "bin"
|
||||
self.run_root = self.bin_dir / "salt.exe"
|
||||
self.ssm_bin = self.install_dir / "ssm.exe"
|
||||
pkg = str(pathlib.Path(self.pkgs[0]).resolve())
|
||||
|
||||
if self.file_ext == "exe":
|
||||
win_pkg = (
|
||||
|
@ -794,16 +794,19 @@ class SaltPkgInstall:
|
|||
download_file(win_pkg_url, pkg_path)
|
||||
|
||||
if self.file_ext == "msi":
|
||||
# Write a batch file to run the installer. It is impossible to
|
||||
# perform escaping of the START_MINION property that the MSI
|
||||
# expects unless we do it via a batch file
|
||||
batch_file = pkg_path.parent / "install_msi.cmd"
|
||||
batch_content = f'msiexec /qn /i {str(pkg_path)} START_MINION=""'
|
||||
with salt.utils.files.fopen(batch_file, "w") as fp:
|
||||
fp.write(batch_content)
|
||||
# Now run the batch file
|
||||
ret = self.proc.run("cmd.exe", "/c", str(batch_file))
|
||||
self._check_retcode(ret)
|
||||
|
||||
# XXX: Both packages end up installed, should we uninstall the old one?
|
||||
# ret = subprocess.run(f"msiexec.exe /qn /x {pkg} /norestart", shell=True)
|
||||
# assert ret.returncode == 0
|
||||
|
||||
# self.proc.run always makes the command a list even when shell
|
||||
# is true, meaning shell being true will never work correctly.
|
||||
ret = subprocess.run(
|
||||
f'msiexec.exe /qn /i {pkg_path} /norestart START_MINION=""',
|
||||
shell=True, # nosec
|
||||
check=False,
|
||||
)
|
||||
assert ret.returncode in [0, 3010]
|
||||
else:
|
||||
ret = self.proc.run(pkg_path, "/start-minion=0", "/S")
|
||||
self._check_retcode(ret)
|
||||
|
@ -812,6 +815,9 @@ class SaltPkgInstall:
|
|||
ret = self.proc.run(str(self.ssm_bin), "remove", "salt-minion", "confirm")
|
||||
self._check_retcode(ret)
|
||||
|
||||
# Add installation to the path
|
||||
self.update_process_path()
|
||||
|
||||
if self.pkg_system_service:
|
||||
self._install_ssm_service()
|
||||
|
||||
|
|
|
@ -889,10 +889,6 @@ def workflow_config(
|
|||
for _ in TEST_SALT_PKG_LISTING[platform]
|
||||
if _.slug in requested_slugs
|
||||
]
|
||||
# Skipping downgrade tests on windows. These tests have never
|
||||
# been run and currently fail. This should be fixed.
|
||||
if platform == "windows":
|
||||
continue
|
||||
pkg_test_matrix[platform] += [
|
||||
dict(
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue