Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,7 @@ def ci_test_onedir_pkgs(session):
+ cmd_args[:]
+ [
"--no-install",
"--no-uninstall",
"--junitxml=artifacts/xml-unittests-output/test-results-install.xml",
"--log-file=artifacts/logs/runtests-install.log",
]
Expand Down
5 changes: 4 additions & 1 deletion tests/pytests/pkg/integration/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def test_compare_versions(binary, install_salt):
"""
Test compare versions
"""
version = install_salt.artifact_version
if install_salt.use_prev_version:
version = install_salt.prev_version
else:
version = install_salt.artifact_version
if binary in install_salt.binary_paths:
if install_salt.upgrade:
install_salt.install()
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/pkg/upgrade/test_salt_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def salt_test_upgrade(
new_minion_pids = _get_running_named_salt_pid(process_minion_name)
new_master_pids = _get_running_named_salt_pid(process_master_name)

if sys.platform == "linux":
if sys.platform == "linux" and install_salt.distro_id not in ("ubuntu", "debian"):
assert new_minion_pids
assert new_master_pids
assert new_minion_pids != old_minion_pids
Expand Down
63 changes: 37 additions & 26 deletions tests/support/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def install_previous(self, downgrade=False):
arch = "amd64"

pathlib.Path("/etc/apt/keyrings").mkdir(parents=True, exist_ok=True)
gpg_full_path = "/etc/apt/keyrings/salt-archive-keyring.gpg"
gpg_full_path = "/etc/apt/keyrings/salt-archive-keyring.pgp"

# download the gpg pub key
download_file(
Expand All @@ -724,28 +724,37 @@ def install_previous(self, downgrade=False):
) as fp:
fp.write(
f"deb [signed-by={gpg_full_path} arch={arch}] "
f"{root_url}/saltproject-deb/ {self.distro_codename} main"
f"{root_url}/saltproject-deb/ stable main"
)
self._check_retcode(ret)
pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt-pin-1001")
pref_file.parent.mkdir(exist_ok=True)
pin = f"{self.prev_version.rsplit('.', 1)[0]}.*"
if downgrade:
pin = self.prev_version
with salt.utils.files.fopen(pref_file, "w") as fp:
fp.write(
f"Package: salt-*\n" f"Pin: version {pin}\n" f"Pin-Priority: 1001"
)

cmd = [self.pkg_mngr, "install", *self.salt_pkgs, "-y"]

if downgrade:
pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt.pref")
pref_file.parent.mkdir(exist_ok=True)
# TODO: There's probably something I should put in here to say what version
# TODO: But maybe that's done elsewhere, hopefully in self.salt_pkgs
pref_file.write_text(
textwrap.dedent(
f"""\
Package: salt*
Pin: origin "{root_url}/saltproject-deb"
Pin-Priority: 1001
"""
),
encoding="utf-8",
)
cmd.append("--allow-downgrades")
# if downgrade:
# pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt-pin-1001")
# pref_file.parent.mkdir(exist_ok=True)
# # TODO: There's probably something I should put in here to say what version
# # TODO: But maybe that's done elsewhere, hopefully in self.salt_pkgs
# pref_file.write_text(
# textwrap.dedent(
# f"""\
# Package: salt*
# Pin: origin "{root_url}/saltproject-deb"
# Pin-Priority: 1001
# """
# ),
# encoding="utf-8",
# )
cmd.append("--allow-downgrades")
env = os.environ.copy()
env["DEBIAN_FRONTEND"] = "noninteractive"
extra_args = [
Expand All @@ -757,18 +766,20 @@ def install_previous(self, downgrade=False):
self.proc.run(self.pkg_mngr, "update", *extra_args, env=env)

cmd.extend(extra_args)

log.error("Run cmd %s", cmd)
ret = self.proc.run(*cmd, env=env)
log.error("cmd return %r", ret)
# Pre-relenv packages down get downgraded to cleanly programmatically
# They work manually, and the install tests after downgrades will catch problems with the install
self._check_retcode(ret)
# Let's not check the returncode if this is the case
if not (
downgrade
and packaging.version.parse(self.prev_version)
< packaging.version.parse("3006.0")
):
self._check_retcode(ret)
if downgrade:
# if not (
# downgrade
# and packaging.version.parse(self.prev_version)
# < packaging.version.parse("3006.0")
# ):
# self._check_retcode(ret)
if downgrade and not self.no_uninstall:
pref_file.unlink()
self.stop_services()
elif platform.is_windows():
Expand Down
Loading