Multiple ssh tests fixed

This commit is contained in:
Daniel A. Wozniak 2025-02-17 19:33:07 -07:00
parent a3b79144c1
commit 31e125f09e
4 changed files with 48 additions and 11 deletions

View file

@ -49,7 +49,7 @@ def get_tarball(kernel, arch):
:param arch: The detected architecture (e.g., 'amd64', 'x86_64', 'arm64').
:return: The URL of the latest tarball.
"""
base_url = "https://repo.saltproject.io/salt/py3/onedir/latest/"
base_url = "https://packages.broadcom.com/artifactory/saltproject-generic/onedir"
try:
# Request the page listing
response = requests.get(base_url, timeout=60)
@ -58,6 +58,16 @@ def get_tarball(kernel, arch):
log.error(f"Failed to retrieve tarball listing: {e}")
raise ValueError("Unable to fetch tarball list from repository")
latest = sorted(re.findall(r"3\d\d\d\.\d", response.text))[-1]
try:
# Request the page listing
response = requests.get(f"{base_url}/{latest}", timeout=60)
response.raise_for_status()
except requests.RequestException as e:
log.error(f"Failed to retrieve tarball listing: {e}")
raise ValueError("Unable to fetch tarball list from repository")
# Search for tarball filenames that match the kernel and arch
pattern = re.compile(rf'href="(salt-.*-onedir-{kernel}-{arch}\.tar\.xz)"')
matches = pattern.findall(response.text)
@ -68,7 +78,7 @@ def get_tarball(kernel, arch):
# Return the latest tarball URL
matches.sort()
latest_tarball = matches[-1]
return base_url + latest_tarball
return f"{base_url}/{latest}/{latest_tarball}"
def download(cachedir, url, destination):

View file

@ -280,6 +280,7 @@ def get_tops_python(py_ver, exclude=None, ext_py_ver=None):
"""
files = {}
mods = [
"distro",
"jinja2",
"yaml",
"tornado",

View file

@ -1777,6 +1777,10 @@ class SaltVirtualEnv(VirtualEnv):
def _create_virtualenv(self):
super()._create_virtualenv()
code_dir = pathlib.Path(RUNTIME_VARS.CODE_DIR)
self.install(
"-r", code_dir / "requirements" / "static" / "pkg" / "py3.10" / "linux.txt"
)
self.install(RUNTIME_VARS.CODE_DIR)
def install(self, *args, **kwargs):

View file

@ -83,17 +83,20 @@ class SSHThinTestCase(TestCase):
code_dir = pathlib.Path(RUNTIME_VARS.CODE_DIR).resolve()
self.exp_ret = {
"certifi": str(code_dir / "certifi"),
"distro": str(code_dir / "distro.py"),
"idna": str(code_dir / "idna"),
"jinja2": str(code_dir / "jinja2"),
"yaml": str(code_dir / "yaml"),
"tornado": str(code_dir / "tornado"),
"msgpack": str(code_dir / "msgpack"),
"networkx": str(code_dir / "networkx"),
"certifi": str(code_dir / "certifi"),
"singledispatch": str(code_dir / "singledispatch.py"),
"looseversion": str(code_dir / "looseversion.py"),
"packaging": str(code_dir / "packaging"),
"requests": str(code_dir / "requests"),
"singledispatch": str(code_dir / "singledispatch.py"),
"tornado": str(code_dir / "tornado"),
"urllib3": str(code_dir / "urllib3"),
"yaml": str(code_dir / "yaml"),
}
self.exc_libs = ["jinja2", "yaml"]
def tearDown(self):
@ -493,6 +496,9 @@ class SSHThinTestCase(TestCase):
"contextvars",
"looseversion",
"packaging",
"requests",
"idna",
"urllib3",
]
if salt.utils.thin.has_immutables:
base_tops.extend(["immutables"])
@ -603,6 +609,9 @@ class SSHThinTestCase(TestCase):
"contextvars",
"looseversion",
"packaging",
"requests",
"idna",
"urllib3",
"foo",
"bar.py",
]
@ -723,6 +732,9 @@ class SSHThinTestCase(TestCase):
"contextvars",
"looseversion",
"packaging",
"requests",
"idna",
"urllib3",
"foo.so",
"bar.so",
]
@ -1172,11 +1184,15 @@ class SSHThinTestCase(TestCase):
self._popen(
None,
side_effect=[
(bts("distro.py"), bts("")),
(bts("jinja2/__init__.py"), bts("")),
(bts("yaml/__init__.py"), bts("")),
(bts("tornado/__init__.py"), bts("")),
(bts("msgpack/__init__.py"), bts("")),
(bts("networkx/__init__.py"), bts("")),
(bts("requests/__init__.py"), bts("")),
(bts("idna/__init__.py"), bts("")),
(bts("urllib3/__init__.py"), bts("")),
(bts("certifi/__init__.py"), bts("")),
(bts("singledispatch.py"), bts("")),
(bts(""), bts("")),
@ -1184,9 +1200,9 @@ class SSHThinTestCase(TestCase):
(bts(""), bts("")),
(bts(""), bts("")),
(bts(""), bts("")),
(bts("looseversion.py"), bts("")),
(bts(""), bts("")),
(bts("packaging/__init__.py"), bts("")),
(bts("distro.py"), bts("")),
(bts(""), bts("")),
],
),
)
@ -1217,9 +1233,15 @@ class SSHThinTestCase(TestCase):
self._popen(
None,
side_effect=[
(bts("distro.py"), bts("")),
# (bts("jinja2/__init__.py"), bts("")),
# (bts("yaml/__init__.py"), bts("")),
(bts("tornado/__init__.py"), bts("")),
(bts("msgpack/__init__.py"), bts("")),
(bts("networkx/__init__.py"), bts("")),
(bts("requests/__init__.py"), bts("")),
(bts("idna/__init__.py"), bts("")),
(bts("urllib3/__init__.py"), bts("")),
(bts("certifi/__init__.py"), bts("")),
(bts("singledispatch.py"), bts("")),
(bts(""), bts("")),
@ -1227,9 +1249,9 @@ class SSHThinTestCase(TestCase):
(bts(""), bts("")),
(bts(""), bts("")),
(bts(""), bts("")),
(bts("looseversion.py"), bts("")),
(bts(""), bts("")),
(bts("packaging/__init__.py"), bts("")),
(bts("distro.py"), bts("")),
(bts(""), bts("")),
],
),
)