Implement automated Fleet Hub upstream client package caching and background update distribution
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 1m14s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 1m14s
This commit is contained in:
@@ -73,8 +73,31 @@ class TestHubUpdateAuthDeep(unittest.TestCase):
|
||||
self.assertTrue(decision.get("update_available"))
|
||||
self.assertEqual(decision.get("latest_version"), "2.5.0")
|
||||
|
||||
decision_uptodate = manager.check_client_update(client_id="node-win-01", current_version="2.5.0", os_type="windows")
|
||||
self.assertFalse(decision_uptodate.get("update_available"))
|
||||
# Test download and caching from simulated upstream assets
|
||||
mock_assets = [
|
||||
{"name": "LOGAR_Client_Setup.exe", "download_url": "http://mock.upstream/LOGAR_Client_Setup.exe"},
|
||||
{"name": "Linux_Client.bin", "download_url": "http://mock.upstream/Linux_Client.bin"}
|
||||
]
|
||||
class MockHttpResp:
|
||||
status = 200
|
||||
def __init__(self):
|
||||
self._read_done = False
|
||||
def __enter__(self):
|
||||
return self
|
||||
def __exit__(self, *args):
|
||||
pass
|
||||
def read(self, size=65536):
|
||||
if not self._read_done:
|
||||
self._read_done = True
|
||||
return b"MOCK_BINARY_DATA_PAYLOAD_2026"
|
||||
return b""
|
||||
|
||||
with patch("urllib.request.urlopen", side_effect=lambda req, timeout=60: MockHttpResp()):
|
||||
cache_res = manager.download_and_cache_client_packages(assets=mock_assets, target_version="2.6.0")
|
||||
self.assertTrue(cache_res["windows"])
|
||||
self.assertTrue(cache_res["linux"])
|
||||
self.assertEqual(len(cache_res["downloaded"]), 2)
|
||||
self.assertEqual(manager.hosted_client_version, "2.6.0")
|
||||
|
||||
def test_auth_manager_components(self):
|
||||
"""Tests PasswordManager, TOTPManager, SessionManager, and RateLimiter."""
|
||||
|
||||
Reference in New Issue
Block a user