|
22 | 22 | QuotaLimiterConfiguration, |
23 | 23 | QuotaSchedulerConfiguration, |
24 | 24 | ServiceConfiguration, |
| 25 | + SkillsConfiguration, |
25 | 26 | TLSConfiguration, |
26 | 27 | UserDataCollection, |
27 | 28 | ) |
@@ -249,6 +250,7 @@ def test_dump_configuration(tmp_path: Path) -> None: |
249 | 250 | "enabled": False, |
250 | 251 | "model": "cross-encoder/ms-marco-MiniLM-L6-v2", |
251 | 252 | }, |
| 253 | + "skills": None, |
252 | 254 | } |
253 | 255 |
|
254 | 256 |
|
@@ -613,6 +615,7 @@ def test_dump_configuration_with_quota_limiters(tmp_path: Path) -> None: |
613 | 615 | "enabled": False, |
614 | 616 | "model": "cross-encoder/ms-marco-MiniLM-L6-v2", |
615 | 617 | }, |
| 618 | + "skills": None, |
616 | 619 | } |
617 | 620 |
|
618 | 621 |
|
@@ -861,6 +864,7 @@ def test_dump_configuration_with_quota_limiters_different_values( |
861 | 864 | "enabled": False, |
862 | 865 | "model": "cross-encoder/ms-marco-MiniLM-L6-v2", |
863 | 866 | }, |
| 867 | + "skills": None, |
864 | 868 | } |
865 | 869 |
|
866 | 870 |
|
@@ -1084,6 +1088,7 @@ def test_dump_configuration_byok(tmp_path: Path) -> None: |
1084 | 1088 | "enabled": False, |
1085 | 1089 | "model": "cross-encoder/ms-marco-MiniLM-L6-v2", |
1086 | 1090 | }, |
| 1091 | + "skills": None, |
1087 | 1092 | } |
1088 | 1093 |
|
1089 | 1094 |
|
@@ -1292,4 +1297,84 @@ def test_dump_configuration_pg_namespace(tmp_path: Path) -> None: |
1292 | 1297 | "enabled": False, |
1293 | 1298 | "model": "cross-encoder/ms-marco-MiniLM-L6-v2", |
1294 | 1299 | }, |
| 1300 | + "skills": None, |
| 1301 | + } |
| 1302 | + |
| 1303 | + |
| 1304 | +def test_dump_configuration_with_skills(tmp_path: Path) -> None: |
| 1305 | + """ |
| 1306 | + Test that Configuration with skills paths can be serialized to JSON. |
| 1307 | +
|
| 1308 | + Verifies that skills paths are properly dumped and serialized as strings. |
| 1309 | + """ |
| 1310 | + cfg = Configuration( |
| 1311 | + name="test_name", |
| 1312 | + service=ServiceConfiguration( |
| 1313 | + tls_config=TLSConfiguration( |
| 1314 | + tls_certificate_path=Path("tests/configuration/server.crt"), |
| 1315 | + tls_key_path=Path("tests/configuration/server.key"), |
| 1316 | + tls_key_password=Path("tests/configuration/password"), |
| 1317 | + ), |
| 1318 | + cors=CORSConfiguration( |
| 1319 | + allow_origins=["foo_origin", "bar_origin", "baz_origin"], |
| 1320 | + allow_credentials=False, |
| 1321 | + allow_methods=["foo_method", "bar_method", "baz_method"], |
| 1322 | + allow_headers=["foo_header", "bar_header", "baz_header"], |
| 1323 | + ), |
| 1324 | + ), |
| 1325 | + llama_stack=LlamaStackConfiguration( |
| 1326 | + use_as_library_client=True, |
| 1327 | + library_client_config_path="tests/configuration/run.yaml", |
| 1328 | + api_key=SecretStr("whatever"), |
| 1329 | + ), |
| 1330 | + user_data_collection=UserDataCollection( |
| 1331 | + feedback_enabled=False, feedback_storage=None |
| 1332 | + ), |
| 1333 | + database=DatabaseConfiguration( |
| 1334 | + sqlite=None, |
| 1335 | + postgres=PostgreSQLDatabaseConfiguration( |
| 1336 | + db="lightspeed_stack", |
| 1337 | + user="ls_user", |
| 1338 | + password=SecretStr("ls_password"), |
| 1339 | + port=5432, |
| 1340 | + ca_cert_path=None, |
| 1341 | + ssl_mode="require", |
| 1342 | + gss_encmode="disable", |
| 1343 | + ), |
| 1344 | + ), |
| 1345 | + mcp_servers=[], |
| 1346 | + customization=None, |
| 1347 | + inference=InferenceConfiguration( |
| 1348 | + default_provider="default_provider", |
| 1349 | + default_model="default_model", |
| 1350 | + ), |
| 1351 | + skills=SkillsConfiguration( |
| 1352 | + paths=[ |
| 1353 | + "/var/skills/openshift-troubleshooting", |
| 1354 | + "/var/skills/code-review", |
| 1355 | + "/opt/custom-skills", |
| 1356 | + ] |
| 1357 | + ), |
| 1358 | + ) |
| 1359 | + assert cfg is not None |
| 1360 | + dump_file = tmp_path / "test.json" |
| 1361 | + cfg.dump(dump_file) |
| 1362 | + |
| 1363 | + with open(dump_file, "r", encoding="utf-8") as fin: |
| 1364 | + content = json.load(fin) |
| 1365 | + # content should be loaded |
| 1366 | + assert content is not None |
| 1367 | + |
| 1368 | + # skills section must exist |
| 1369 | + assert "skills" in content |
| 1370 | + assert content["skills"] is not None |
| 1371 | + assert "paths" in content["skills"] |
| 1372 | + |
| 1373 | + # verify skills paths are properly serialized |
| 1374 | + assert content["skills"] == { |
| 1375 | + "paths": [ |
| 1376 | + "/var/skills/openshift-troubleshooting", |
| 1377 | + "/var/skills/code-review", |
| 1378 | + "/opt/custom-skills", |
| 1379 | + ] |
1295 | 1380 | } |
0 commit comments