v1.1.52: fix scenario create (drop svcOperationId) + http_client _status debug

This commit is contained in:
2026-07-30 15:51:22 +04:00
parent 6f051aa348
commit 7354d9c125
3 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -105,11 +105,12 @@ class HttpClient:
r = self._session.post(url, json=(data if data is not None else {}), **kwargs) r = self._session.post(url, json=(data if data is not None else {}), **kwargs)
if not r.ok: if not r.ok:
raise Exception(f"POST {path}: {r.status_code} {r.reason}: {r.text[:200]}") raise Exception(f"POST {path}: {r.status_code} {r.reason}: {r.text[:200]}")
result = {} result = {"_status": r.status_code}
try: try:
parsed = r.json() parsed = r.json()
if isinstance(parsed, dict): if isinstance(parsed, dict):
result = parsed result = parsed
result["_status"] = r.status_code
except Exception: except Exception:
pass # тело не JSON или не dict — ок, Location всё равно извлечём pass # тело не JSON или не dict — ок, Location всё равно извлечём
loc = r.headers.get("Location", "") loc = r.headers.get("Location", "")
+1 -1
View File
@@ -18,7 +18,7 @@ from routes.api_test import bp as api_test_bp
from routes.api_scenario import bp as api_scenario_bp from routes.api_scenario import bp as api_scenario_bp
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
VERSION = "1.1.51" VERSION = "1.1.52"
app = Flask(__name__, template_folder="templates", static_folder="static") app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
+3
View File
@@ -124,6 +124,9 @@ def run_scenario(client, steps, client_id, stand, user_email, app_version, scena
raise RuntimeError(f"No instance for service_id {svc_id} — need CREATE first") raise RuntimeError(f"No instance for service_id {svc_id} — need CREATE first")
# 4. Запуск операции # 4. Запуск операции
if op_name == "create":
op_payload = {"instanceUid": instance_uid, "operation": op_name}
else:
op_payload = {"instanceUid": instance_uid, "svcOperationId": svc_op_id, "operation": op_name} op_payload = {"instanceUid": instance_uid, "svcOperationId": svc_op_id, "operation": op_name}
op_resp = client.post("/instanceOperations", op_payload) op_resp = client.post("/instanceOperations", op_payload)
op_uid = op_resp.get("instanceOperationUid") or _find_uid(op_resp) or _uid_from_location(op_resp.get("_location", "")) op_uid = op_resp.get("instanceOperationUid") or _find_uid(op_resp) or _uid_from_location(op_resp.get("_location", ""))