Skip to content

Commit

Permalink
Remove Tiamat and Classic testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Oct 14, 2024
1 parent e319f3e commit fe57d99
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 73 deletions.
2 changes: 1 addition & 1 deletion tests/pytests/pkg/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def salt_master(salt_factories, install_salt, pkg_tests_account):
"""
if platform.is_windows():
state_tree = f'{os.getenv("ProgramData")}/Salt Project/Salt/srv/salt'
pillar_tree = f'{os.getenv("ProgramData")}/Salt/srv/pillar'
pillar_tree = f'{os.getenv("ProgramData")}/Salt Project/Salt/srv/pillar'
elif platform.is_darwin():
state_tree = "/opt/srv/salt"
pillar_tree = "/opt/srv/pillar"
Expand Down
3 changes: 1 addition & 2 deletions tests/pytests/pkg/downgrade/test_salt_downgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt):
if install_salt.distro_id in ("ubuntu", "debian"):
install_salt.restart_services()

# Give it some time
time.sleep(60)
time.sleep(60) # give it some time

files = os.listdir(install_salt.install_dir)

Expand Down
92 changes: 22 additions & 70 deletions tests/support/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,29 +272,12 @@ def __attrs_post_init__(self):
self.file_ext = os.path.splitext(f_path)[1].strip(".")
self.pkgs.append(f_path)
if platform.is_windows():
self.root = pathlib.Path(os.getenv("LocalAppData")).resolve()
if self.file_ext in ["exe", "msi"]:
self.root = self.install_dir.parent
self.bin_dir = self.install_dir
self.bin_dir = self.install_dir / "Scripts"
self.ssm_bin = self.install_dir / "ssm.exe"
self.run_root = self.bin_dir / "bin" / "salt.exe"
if not self.relenv and not self.classic:
self.ssm_bin = self.bin_dir / "bin" / "ssm.exe"
else:
log.error("Unexpected file extension: %s", self.file_ext)
if self.use_prev_version:
self.bin_dir = self.install_dir / "bin"
self.run_root = self.bin_dir / "salt.exe"
self.ssm_bin = self.bin_dir / "ssm.exe"
if self.file_ext == "msi" or self.relenv:
self.ssm_bin = self.install_dir / "ssm.exe"
if (
self.install_dir / "salt-minion.exe"
).exists() and not self.relenv:
log.debug(
"Removing %s", self.install_dir / "salt-minion.exe"
)
(self.install_dir / "salt-minion.exe").unlink()

elif platform.is_darwin():
self.root = pathlib.Path("/opt")
Expand All @@ -313,31 +296,14 @@ def __attrs_post_init__(self):

python_bin = self.install_dir / "bin" / "python3"
if platform.is_windows():
python_bin = self.install_dir / "Scripts" / "python.exe"
if self.relenv:
self.binary_paths = {
"call": ["salt-call.exe"],
"cp": ["salt-cp.exe"],
"minion": ["salt-minion.exe"],
"pip": ["salt-pip.exe"],
"python": [python_bin],
}
elif self.classic:
self.binary_paths = {
"call": [self.install_dir / "salt-call.bat"],
"cp": [self.install_dir / "salt-cp.bat"],
"minion": [self.install_dir / "salt-minion.bat"],
"python": [self.bin_dir / "python.exe"],
}
self.binary_paths["pip"] = self.binary_paths["python"] + ["-m", "pip"]
else:
self.binary_paths = {
"call": [str(self.run_root), "call"],
"cp": [str(self.run_root), "cp"],
"minion": [str(self.run_root), "minion"],
"pip": [str(self.run_root), "pip"],
"python": [str(self.run_root), "shell"],
}
python_bin = self.bin_dir / "python.exe"
self.binary_paths = {
"call": ["salt-call.exe"],
"cp": ["salt-cp.exe"],
"minion": ["salt-minion.exe"],
"pip": ["salt-pip.exe"],
"python": [python_bin],
}

else:
if os.path.exists(self.install_dir / "bin" / "salt"):
Expand Down Expand Up @@ -446,7 +412,7 @@ def _install_pkgs(self, upgrade=False, downgrade=False):
if platform.is_windows():
if upgrade:
self.root = self.install_dir.parent
self.bin_dir = self.install_dir
self.bin_dir = self.install_dir / "Scripts"
self.ssm_bin = self.install_dir / "ssm.exe"
if pkg.endswith("exe"):
# Install the package
Expand Down Expand Up @@ -788,33 +754,19 @@ def install_previous(self, downgrade=False):
pref_file.unlink()
self.stop_services()
elif platform.is_windows():
self.bin_dir = self.install_dir / "bin"
self.run_root = self.bin_dir / "salt.exe"
self.ssm_bin = self.bin_dir / "ssm.exe"
if self.file_ext == "msi" or relenv:
self.ssm_bin = self.install_dir / "ssm.exe"
self.bin_dir = self.install_dir / "Scripts"
self.ssm_bin = self.install_dir / "ssm.exe"
if self.file_ext == "msi":
win_pkg = f"Salt-Minion-{self.prev_version}-Py3-AMD64.{self.file_ext}"
elif self.file_ext == "exe":
win_pkg = (
f"Salt-Minion-{self.prev_version}-Py3-AMD64-Setup.{self.file_ext}"
)
win_pkg_url = (
f"https://repo.saltproject.io/salt/py3/windows/{major_ver}/{win_pkg}"
)

if not self.classic:
if not relenv:
win_pkg = (
f"salt-{self.prev_version}-1-windows-amd64.{self.file_ext}"
)
else:
if self.file_ext == "msi":
win_pkg = (
f"Salt-Minion-{self.prev_version}-Py3-AMD64.{self.file_ext}"
)
elif self.file_ext == "exe":
win_pkg = f"Salt-Minion-{self.prev_version}-Py3-AMD64-Setup.{self.file_ext}"
win_pkg_url = f"https://repo.saltproject.io/salt/py3/windows/{major_ver}/{win_pkg}"
else:
if self.file_ext == "msi":
win_pkg = (
f"Salt-Minion-{self.prev_version}-Py3-AMD64.{self.file_ext}"
)
elif self.file_ext == "exe":
win_pkg = f"Salt-Minion-{self.prev_version}-Py3-AMD64-Setup.{self.file_ext}"
win_pkg_url = f"https://repo.saltproject.io/windows/{win_pkg}"
# Download package to C:\TEMP
pkg_path = pathlib.Path(r"C:\TEMP", win_pkg)
pkg_path.parent.mkdir(exist_ok=True)
download_file(win_pkg_url, pkg_path)
Expand Down

0 comments on commit fe57d99

Please sign in to comment.