- Phase 0: help/README 核心-扩展-遗留分层;action_tiers 写操作分档 - Phase 1: 9 意图 tab、默认总览、旧 id 映射、Hero 仅总览 - Phase 3: joy.core.cluster_data + joy data(≡cluster-data);web search/catalog 同源 - Phase 2: GET /api/dashboard/lite;control 档默认拒绝 - prlctl/clone_restart 标 deprecated;测试 27 passed
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""joy data / cluster_data 同源测试"""
|
|
|
|
from joy.core.cluster_data import catalog_summary, find_registry, load_registry
|
|
from joy.core.action_tiers import tier_for_args
|
|
|
|
|
|
def test_registry_exists():
|
|
reg = find_registry()
|
|
assert reg is not None, "cluster-data-registry.yml should exist on this Mac"
|
|
assert reg.exists()
|
|
|
|
|
|
def test_catalog_summary_shape():
|
|
c = catalog_summary()
|
|
assert "assets" in c
|
|
assert "total_assets" in c
|
|
assert "total_rows" in c
|
|
assert "searchable" in c
|
|
assert c["total_assets"] >= 1
|
|
assert isinstance(c["assets"], list)
|
|
if c["assets"]:
|
|
a = c["assets"][0]
|
|
assert "id" in a and "vm" in a and "type" in a
|
|
|
|
|
|
def test_load_registry_has_assets():
|
|
d = load_registry()
|
|
assert "assets" in d
|
|
assert len(d.get("assets") or []) >= 1
|
|
|
|
|
|
def test_action_tiers():
|
|
assert tier_for_args(["dashboard", "--json"]) == "observe"
|
|
assert tier_for_args(["board", "create", "devops", "hi"]) == "register"
|
|
assert tier_for_args(["board", "route", "BT-1", "--target", "devops"]) == "register"
|
|
assert tier_for_args(["board", "route", "BT-1", "--target", "devops", "--full"]) == "control"
|
|
assert tier_for_args(["work_rebuild", "devops"]) == "execute"
|