Skip to content

Commit fe9160a

Browse files
committed
Skill loading unit test
1 parent 1011ab9 commit fe9160a

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

tests/unit/models/config/test_dump_configuration.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,81 @@ def test_dump_configuration_pg_namespace(tmp_path: Path) -> None:
14971497
}
14981498

14991499

1500+
def test_dump_configuration_with_one_skill(tmp_path: Path) -> None:
1501+
"""
1502+
Test that Configuration with one skill path can be serialized to JSON.
1503+
1504+
Verifies that skills paths are properly dumped and serialized as strings.
1505+
"""
1506+
cfg = Configuration(
1507+
name="test_name",
1508+
service=ServiceConfiguration(
1509+
tls_config=TLSConfiguration(
1510+
tls_certificate_path=Path("tests/configuration/server.crt"),
1511+
tls_key_path=Path("tests/configuration/server.key"),
1512+
tls_key_password=Path("tests/configuration/password"),
1513+
),
1514+
cors=CORSConfiguration(
1515+
allow_origins=["foo_origin", "bar_origin", "baz_origin"],
1516+
allow_credentials=False,
1517+
allow_methods=["foo_method", "bar_method", "baz_method"],
1518+
allow_headers=["foo_header", "bar_header", "baz_header"],
1519+
),
1520+
),
1521+
llama_stack=LlamaStackConfiguration(
1522+
use_as_library_client=True,
1523+
library_client_config_path="tests/configuration/run.yaml",
1524+
api_key=SecretStr("whatever"),
1525+
),
1526+
user_data_collection=UserDataCollection(
1527+
feedback_enabled=False, feedback_storage=None
1528+
),
1529+
database=DatabaseConfiguration(
1530+
sqlite=None,
1531+
postgres=PostgreSQLDatabaseConfiguration(
1532+
db="lightspeed_stack",
1533+
user="ls_user",
1534+
password=SecretStr("ls_password"),
1535+
port=5432,
1536+
ca_cert_path=None,
1537+
ssl_mode="require",
1538+
gss_encmode="disable",
1539+
),
1540+
),
1541+
mcp_servers=[],
1542+
customization=None,
1543+
inference=InferenceConfiguration(
1544+
default_provider="default_provider",
1545+
default_model="default_model",
1546+
),
1547+
skills=SkillsConfiguration(
1548+
paths=[
1549+
"/var/skills/openshift-troubleshooting",
1550+
]
1551+
),
1552+
)
1553+
assert cfg is not None
1554+
dump_file = tmp_path / "test.json"
1555+
cfg.dump(dump_file)
1556+
1557+
with open(dump_file, "r", encoding="utf-8") as fin:
1558+
content = json.load(fin)
1559+
# content should be loaded
1560+
assert content is not None
1561+
1562+
# skills section must exist
1563+
assert "skills" in content
1564+
assert content["skills"] is not None
1565+
assert "paths" in content["skills"]
1566+
1567+
# verify skills paths are properly serialized
1568+
assert content["skills"] == {
1569+
"paths": [
1570+
"/var/skills/openshift-troubleshooting",
1571+
]
1572+
}
1573+
1574+
15001575
def test_dump_configuration_with_skills(tmp_path: Path) -> None:
15011576
"""
15021577
Test that Configuration with skills paths can be serialized to JSON.

0 commit comments

Comments
 (0)