fix(hub): offload upstream update check to thread executor and increase test timeout
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 3m26s
Build and Push LOGAR Runner / Build & Push Runner Image (push) Canceled after 9m29s
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Canceled after 6m8s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 3m26s
Build and Push LOGAR Runner / Build & Push Runner Image (push) Canceled after 9m29s
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Canceled after 6m8s
This commit is contained in:
+2
-1
@@ -2237,7 +2237,8 @@ async def update_checker_loop(interval_hours: int = 1):
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
mgr: ServerUpdateManager = SERVER_STATE.get("update_manager") or UPDATE_MANAGER
|
mgr: ServerUpdateManager = SERVER_STATE.get("update_manager") or UPDATE_MANAGER
|
||||||
mgr.check_upstream_updates(force=False, auto_download_clients=True)
|
loop = asyncio.get_running_loop()
|
||||||
|
await loop.run_in_executor(None, lambda: mgr.check_upstream_updates(force=False, auto_download_clients=True))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[!] Warning in update checker background loop: {e}")
|
print(f"[!] Warning in update checker background loop: {e}")
|
||||||
await asyncio.sleep(interval_hours * 3600)
|
await asyncio.sleep(interval_hours * 3600)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ def run_tests():
|
|||||||
|
|
||||||
# 1. Check current license status
|
# 1. Check current license status
|
||||||
req_status_init = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/status")
|
req_status_init = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/status")
|
||||||
with urllib.request.urlopen(req_status_init, timeout=5) as resp:
|
with urllib.request.urlopen(req_status_init, timeout=15) as resp:
|
||||||
init_lic_stat = json.loads(resp.read().decode("utf-8"))
|
init_lic_stat = json.loads(resp.read().decode("utf-8"))
|
||||||
|
|
||||||
if init_lic_stat.get("status") == "UNLICENSED":
|
if init_lic_stat.get("status") == "UNLICENSED":
|
||||||
@@ -85,7 +85,7 @@ def run_tests():
|
|||||||
headers={"Content-Type": "application/json"}
|
headers={"Content-Type": "application/json"}
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req_unlicensed, timeout=5):
|
with urllib.request.urlopen(req_unlicensed, timeout=15):
|
||||||
assert False, "Expected HTTP 403 on unlicensed server enrollment"
|
assert False, "Expected HTTP 403 on unlicensed server enrollment"
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
assert e.code == 403, f"Expected HTTP 403 on unlicensed server, got {e.code}"
|
assert e.code == 403, f"Expected HTTP 403 on unlicensed server, got {e.code}"
|
||||||
@@ -96,7 +96,7 @@ def run_tests():
|
|||||||
f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/csr",
|
f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/csr",
|
||||||
headers={"Authorization": f"Bearer {auth_token}"}
|
headers={"Authorization": f"Bearer {auth_token}"}
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req_csr, timeout=5) as resp:
|
with urllib.request.urlopen(req_csr, timeout=15) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
csr_data = json.loads(resp.read().decode("utf-8"))
|
csr_data = json.loads(resp.read().decode("utf-8"))
|
||||||
csr_pem = csr_data["csr"]
|
csr_pem = csr_data["csr"]
|
||||||
@@ -121,7 +121,7 @@ def run_tests():
|
|||||||
data=json.dumps(import_payload).encode("utf-8"),
|
data=json.dumps(import_payload).encode("utf-8"),
|
||||||
headers={"Content-Type": "application/json", "Authorization": f"Bearer {auth_token}"}
|
headers={"Content-Type": "application/json", "Authorization": f"Bearer {auth_token}"}
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req_import, timeout=5) as resp:
|
with urllib.request.urlopen(req_import, timeout=15) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
import_res = json.loads(resp.read().decode("utf-8"))
|
import_res = json.loads(resp.read().decode("utf-8"))
|
||||||
assert import_res["status"] == "success"
|
assert import_res["status"] == "success"
|
||||||
@@ -130,7 +130,7 @@ def run_tests():
|
|||||||
|
|
||||||
# 5. Verify license status
|
# 5. Verify license status
|
||||||
req_status = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/status")
|
req_status = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/license/status")
|
||||||
with urllib.request.urlopen(req_status, timeout=5) as resp:
|
with urllib.request.urlopen(req_status, timeout=15) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
lic_stat = json.loads(resp.read().decode("utf-8"))
|
lic_stat = json.loads(resp.read().decode("utf-8"))
|
||||||
assert lic_stat["status"] == "ACTIVE"
|
assert lic_stat["status"] == "ACTIVE"
|
||||||
@@ -153,7 +153,7 @@ def run_tests():
|
|||||||
headers={"Content-Type": "application/json"}
|
headers={"Content-Type": "application/json"}
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req_bad, timeout=5):
|
with urllib.request.urlopen(req_bad, timeout=15):
|
||||||
assert False, "Expected HTTP 403 on invalid secret"
|
assert False, "Expected HTTP 403 on invalid secret"
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
assert e.code == 403, f"Expected HTTP 403, got {e.code}"
|
assert e.code == 403, f"Expected HTTP 403, got {e.code}"
|
||||||
@@ -171,7 +171,7 @@ def run_tests():
|
|||||||
data=json.dumps(valid_enroll_payload).encode("utf-8"),
|
data=json.dumps(valid_enroll_payload).encode("utf-8"),
|
||||||
headers={"Content-Type": "application/json"}
|
headers={"Content-Type": "application/json"}
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req_valid, timeout=5) as resp:
|
with urllib.request.urlopen(req_valid, timeout=15) as resp:
|
||||||
assert resp.status == 200, f"Expected 200, got {resp.status}"
|
assert resp.status == 200, f"Expected 200, got {resp.status}"
|
||||||
enroll_data = json.loads(resp.read().decode("utf-8"))
|
enroll_data = json.loads(resp.read().decode("utf-8"))
|
||||||
assert "ca_cert" in enroll_data
|
assert "ca_cert" in enroll_data
|
||||||
@@ -194,7 +194,7 @@ def run_tests():
|
|||||||
auth_tok = server_conf.get("auth_token") or client_conf.get("auth_token")
|
auth_tok = server_conf.get("auth_token") or client_conf.get("auth_token")
|
||||||
client_headers = {"Authorization": f"Bearer {auth_tok}"} if auth_tok else {}
|
client_headers = {"Authorization": f"Bearer {auth_tok}"} if auth_tok else {}
|
||||||
clients_req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/clients", headers=client_headers)
|
clients_req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/clients", headers=client_headers)
|
||||||
with urllib.request.urlopen(clients_req, timeout=5) as resp:
|
with urllib.request.urlopen(clients_req, timeout=15) as resp:
|
||||||
clients_data = json.loads(resp.read().decode("utf-8"))
|
clients_data = json.loads(resp.read().decode("utf-8"))
|
||||||
assert clients_data["active_seats"] >= 1
|
assert clients_data["active_seats"] >= 1
|
||||||
found_c = any(c["client_id"] == client_id for c in clients_data["clients"])
|
found_c = any(c["client_id"] == client_id for c in clients_data["clients"])
|
||||||
@@ -294,7 +294,7 @@ def run_tests():
|
|||||||
token = server_conf.get("auth_token") or client_conf.get("auth_token")
|
token = server_conf.get("auth_token") or client_conf.get("auth_token")
|
||||||
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
||||||
req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/hermes/report", headers=headers)
|
req = urllib.request.Request(f"http://{HERMES_HOST}:{HERMES_PORT}/api/hermes/report", headers=headers)
|
||||||
with urllib.request.urlopen(req, timeout=5) as response:
|
with urllib.request.urlopen(req, timeout=15) as response:
|
||||||
assert response.status == 200, f"Expected 200, got {response.status}"
|
assert response.status == 200, f"Expected 200, got {response.status}"
|
||||||
hermes_data = json.loads(response.read().decode("utf-8"))
|
hermes_data = json.loads(response.read().decode("utf-8"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user