Use session workspace slug in product smoke
Deploy / deploy (push) Failing after 1m30s
CI / Rust Checks (push) Successful in 5m57s
CI / UI Checks (push) Successful in 5s
CI / Deployment Manifests (push) Successful in 2s
CI / Frontend E2E (push) Successful in 4m34s

This commit is contained in:
github-ops
2026-06-22 18:38:36 +00:00
parent 5f8149d0d1
commit 87cdb95b80
2 changed files with 74 additions and 9 deletions
+42 -7
View File
@@ -178,6 +178,35 @@ def login(client: Client, email: str, password: str) -> None:
)
def resolve_workspace(
client: Client,
fallback_workspace_id: str,
fallback_workspace_slug: str,
) -> tuple[str, str]:
session = client.request_json("GET", "/api/auth/session").body
memberships = session.get("memberships") or []
current_workspace_id = session.get("current_workspace_id") or fallback_workspace_id
membership = next(
(
item
for item in memberships
if item.get("workspace", {}).get("id") == current_workspace_id
),
None,
)
if not membership and memberships:
membership = memberships[0]
workspace = membership.get("workspace", {}) if membership else {}
workspace_id = workspace.get("id") or current_workspace_id
workspace_slug = workspace.get("slug") or fallback_workspace_slug
if not workspace_id:
raise SmokeError("authenticated session does not include a workspace id")
if not workspace_slug:
raise SmokeError("authenticated session does not include a workspace slug")
return workspace_id, workspace_slug
def create_operation(
client: Client,
workspace_id: str,
@@ -378,23 +407,29 @@ def run(args: argparse.Namespace) -> None:
print(f"authenticated product smoke: {args.base_url.rstrip('/')}")
login(client, admin_email, admin_password)
print("login: ok")
workspace_id, workspace_slug = resolve_workspace(
client,
args.workspace_id,
args.workspace_slug,
)
print(f"workspace: {workspace_id} / {workspace_slug}")
operation_id = create_operation(
client,
args.workspace_id,
workspace_id,
operation_name,
args.internal_upstream,
)
print(f"operation created: {operation_id}")
publish_operation(client, args.workspace_id, operation_id)
publish_operation(client, workspace_id, operation_id)
print("operation published: v1")
agent_id = create_agent(client, args.workspace_id, agent_slug)
bind_and_publish_agent(client, args.workspace_id, agent_id, operation_id, operation_name)
agent_id = create_agent(client, workspace_id, agent_slug)
bind_and_publish_agent(client, workspace_id, agent_id, operation_id, operation_name)
print(f"agent published: {agent_id}")
api_key, key_id = create_agent_key(client, args.workspace_id, agent_id)
mcp_url = agent_mcp_url(args.base_url, args.workspace_slug, agent_slug)
api_key, key_id = create_agent_key(client, workspace_id, agent_id)
mcp_url = agent_mcp_url(args.base_url, workspace_slug, agent_slug)
session_id = initialize_mcp_session(client, mcp_url, api_key)
print("mcp initialized: ok")
@@ -420,7 +455,7 @@ def run(args: argparse.Namespace) -> None:
if "error" in result:
raise SmokeError(f"tools/call returned error: {result['error']}")
print("tools/call: ok")
cleanup_smoke_assets(client, args.workspace_id, operation_id, agent_id, key_id)
cleanup_smoke_assets(client, workspace_id, operation_id, agent_id, key_id)
print("authenticated product smoke completed")