Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
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
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ def ci_test_onedir_pkgs(session):
except CommandFailed:
if os.environ.get("RERUN_FAILURES", "0") == "0":
# Don't rerun on failures
return
sys.exit(1)

# Don't print the system information, not the test selection on reruns
global PRINT_TEST_SELECTION
Expand Down Expand Up @@ -1962,7 +1962,7 @@ def ci_test_onedir_pkgs(session):
except CommandFailed:
if os.environ.get("RERUN_FAILURES", "0") == "0":
# Don't rerun on failures
return
sys.exit(1)
cmd_args = chunks["install"]
pytest_args = (
common_pytest_args[:]
Expand Down
2 changes: 1 addition & 1 deletion salt/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def string(self):
version_string += f".{self.mbugfix}"
if self.pre_type:
version_string += f"{self.pre_type}{self.pre_num}"
if self.noc and self.sha:
if self.noc is not None and self.sha:
noc = self.noc
if noc < 0:
noc = "0na"
Expand Down
3 changes: 3 additions & 0 deletions tests/pytests/pkg/integration/test_salt_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def test_paths_log_rotation(
Check ownership and premissions.
Assumes test_pkg_paths successful
"""
pytest.skip(
"Test has too many side effects that cause other tests to fail. needs refactor"
)
if packaging.version.parse(install_salt.version) <= packaging.version.parse(
"3006.4"
):
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
10 changes: 8 additions & 2 deletions tests/pytests/pkg/upgrade/test_salt_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def salt_test_upgrade(
# Upgrade Salt (inc. minion, master, etc.) from previous version and test
install_salt.install(upgrade=True)

time.sleep(60) # give it some time
start = time.monotonic()
while True:
ret = salt_call_cli.run("--local", "test.version", _timeout=10)
if ret.returncode == 0:
break
if time.monotonic() - start > 60:
break

ret = salt_call_cli.run("--local", "test.version")
assert ret.returncode == 0
Expand All @@ -95,7 +101,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
4 changes: 3 additions & 1 deletion tools/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,8 @@ def workflow_config(
]
for version in str_releases:
for platform in platforms:
# Skip upgrade tests on photonos due to lack of package pinning
# support.
pkg_test_matrix[platform] += [
dict(
{
Expand All @@ -887,7 +889,7 @@ def workflow_config(
**_.as_dict(),
)
for _ in TEST_SALT_PKG_LISTING[platform]
if _.slug in requested_slugs
if _.slug in requested_slugs and "photon" not in _.slut
]
pkg_test_matrix[platform] += [
dict(
Expand Down
30 changes: 16 additions & 14 deletions tools/precommit/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,22 @@
pkg_type="rpm",
container="ghcr.io/saltstack/salt-ci-containers/testing:rockylinux-9",
),
LinuxPkg(
slug="amazonlinux-2",
display_name="Amazon Linux 2",
arch="x86_64",
pkg_type="rpm",
container="ghcr.io/saltstack/salt-ci-containers/testing:amazonlinux-2",
),
LinuxPkg(
slug="amazonlinux-2-arm64",
display_name="Amazon Linux 2 Arm64",
arch="arm64",
pkg_type="rpm",
container="ghcr.io/saltstack/salt-ci-containers/testing:amazonlinux-2",
),
# Amazon linux 2 containers have degraded systemd so the package
# tests will not pass.
# LinuxPkg(
# slug="amazonlinux-2",
# display_name="Amazon Linux 2",
# arch="x86_64",
# pkg_type="rpm",
# container="ghcr.io/saltstack/salt-ci-containers/testing:amazonlinux-2",
# ),
# LinuxPkg(
# slug="amazonlinux-2-arm64",
# display_name="Amazon Linux 2 Arm64",
# arch="arm64",
# pkg_type="rpm",
# container="ghcr.io/saltstack/salt-ci-containers/testing:amazonlinux-2",
# ),
LinuxPkg(
slug="amazonlinux-2023",
display_name="Amazon Linux 2023",
Expand Down
Loading