Skip to content

Commit 3af0d76

Browse files
committed
✨Agent runtime isolation Step1: Service decomposition based on Docker #606
[Specification implement] Rename all edit_time to config.
1 parent 98d1dbf commit 3af0d76

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

docker/generate_env.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ update_env_file() {
107107
fi
108108

109109
# Main Services
110-
# EDIT_TIME_SERVICE_URL
111-
if grep -q "^EDIT_TIME_SERVICE_URL=" ../.env; then
112-
sed -i.bak "s~^EDIT_TIME_SERVICE_URL=.*~EDIT_TIME_SERVICE_URL=http://localhost:5010~" ../.env
110+
# CONFIG_SERVICE_URL
111+
if grep -q "^CONFIG_SERVICE_URL=" ../.env; then
112+
sed -i.bak "s~^CONFIG_SERVICE_URL=.*~CONFIG_SERVICE_URL=http://localhost:5010~" ../.env
113113
else
114114
echo "" >> ../.env
115115
echo "# Main Services" >> ../.env
116-
echo "EDIT_TIME_SERVICE_URL=http://localhost:5010" >> ../.env
116+
echo "CONFIG_SERVICE_URL=http://localhost:5010" >> ../.env
117117
fi
118118

119119
# RUNTIME_SERVICE_URL

test/backend/app/test_agent_app.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def stop_patches():
145145

146146
config_app = FastAPI()
147147
config_app.include_router(agent_config_router)
148-
edit_time_client = TestClient(config_app)
148+
config_client = TestClient(config_app)
149149

150150

151151
@pytest.fixture
@@ -248,7 +248,7 @@ def test_search_agent_info_api_success(mocker, mock_auth_header):
248248
mock_get_agent_info.return_value = {"agent_id": 123, "name": "Test Agent"}
249249

250250
# Test the endpoint
251-
response = edit_time_client.post(
251+
response = config_client.post(
252252
"/agent/search_info",
253253
json=123, # agent_id as body parameter
254254
headers=mock_auth_header
@@ -270,7 +270,7 @@ def test_search_agent_info_api_exception(mocker, mock_auth_header):
270270
mock_get_agent_info.side_effect = Exception("Test error")
271271

272272
# Test the endpoint
273-
response = edit_time_client.post(
273+
response = config_client.post(
274274
"/agent/search_info",
275275
json=123,
276276
headers=mock_auth_header
@@ -288,7 +288,7 @@ def test_get_creating_sub_agent_info_api_success(mocker, mock_auth_header):
288288
mock_get_creating_agent.return_value = {"agent_id": 456}
289289

290290
# Test the endpoint - this is a GET request
291-
response = edit_time_client.get(
291+
response = config_client.get(
292292
"/agent/get_creating_sub_agent_id",
293293
headers=mock_auth_header
294294
)
@@ -307,7 +307,7 @@ def test_get_creating_sub_agent_info_api_exception(mocker, mock_auth_header):
307307
mock_get_creating_agent.side_effect = Exception("Test error")
308308

309309
# Test the endpoint - this is a GET request
310-
response = edit_time_client.get(
310+
response = config_client.get(
311311
"/agent/get_creating_sub_agent_id",
312312
headers=mock_auth_header
313313
)
@@ -324,7 +324,7 @@ def test_update_agent_info_api_success(mocker, mock_auth_header):
324324
mock_update_agent.return_value = None
325325

326326
# Test the endpoint
327-
response = edit_time_client.post(
327+
response = config_client.post(
328328
"/agent/update",
329329
json={"agent_id": 123, "name": "Updated Agent",
330330
"display_name": "Updated Display Name"},
@@ -344,7 +344,7 @@ def test_update_agent_info_api_exception(mocker, mock_auth_header):
344344
mock_update_agent.side_effect = Exception("Test error")
345345

346346
# Test the endpoint
347-
response = edit_time_client.post(
347+
response = config_client.post(
348348
"/agent/update",
349349
json={"agent_id": 123, "name": "Updated Agent",
350350
"display_name": "Updated Display Name"},
@@ -363,7 +363,7 @@ def test_delete_agent_api_success(mocker, mock_auth_header):
363363
mock_delete_agent.return_value = None
364364

365365
# Test the endpoint
366-
response = edit_time_client.request(
366+
response = config_client.request(
367367
"DELETE",
368368
"/agent",
369369
json={"agent_id": 123},
@@ -384,7 +384,7 @@ def test_delete_agent_api_exception(mocker, mock_auth_header):
384384
mock_delete_agent.side_effect = Exception("Test error")
385385

386386
# Test the endpoint
387-
response = edit_time_client.request(
387+
response = config_client.request(
388388
"DELETE",
389389
"/agent",
390390
json={"agent_id": 123},
@@ -404,7 +404,7 @@ async def test_export_agent_api_success(mocker, mock_auth_header):
404404
mock_export_agent.return_value = '{"agent_id": 123, "name": "Test Agent"}'
405405

406406
# Test the endpoint
407-
response = edit_time_client.post(
407+
response = config_client.post(
408408
"/agent/export",
409409
json={"agent_id": 123},
410410
headers=mock_auth_header
@@ -426,7 +426,7 @@ async def test_export_agent_api_exception(mocker, mock_auth_header):
426426
mock_export_agent.side_effect = Exception("Test error")
427427

428428
# Test the endpoint
429-
response = edit_time_client.post(
429+
response = config_client.post(
430430
"/agent/export",
431431
json={"agent_id": 123},
432432
headers=mock_auth_header
@@ -444,7 +444,7 @@ def test_import_agent_api_success(mocker, mock_auth_header):
444444
mock_import_agent.return_value = None
445445

446446
# Test the endpoint - following the ExportAndImportDataFormat structure
447-
response = edit_time_client.post(
447+
response = config_client.post(
448448
"/agent/import",
449449
json={
450450
"agent_info": {
@@ -488,7 +488,7 @@ def test_import_agent_api_exception(mocker, mock_auth_header):
488488
mock_import_agent.side_effect = Exception("Test error")
489489

490490
# Test the endpoint - following the ExportAndImportDataFormat structure
491-
response = edit_time_client.post(
491+
response = config_client.post(
492492
"/agent/import",
493493
json={
494494
"agent_info": {
@@ -534,7 +534,7 @@ def test_list_all_agent_info_api_success(mocker, mock_auth_header):
534534
]
535535

536536
# Test the endpoint
537-
response = edit_time_client.get(
537+
response = config_client.get(
538538
"/agent/list",
539539
headers=mock_auth_header
540540
)
@@ -560,7 +560,7 @@ def test_list_all_agent_info_api_exception(mocker, mock_auth_header):
560560
mock_list_all_agent.side_effect = Exception("Test error")
561561

562562
# Test the endpoint
563-
response = edit_time_client.get(
563+
response = config_client.get(
564564
"/agent/list",
565565
headers=mock_auth_header
566566
)
@@ -591,7 +591,7 @@ async def test_export_agent_api_detailed(mocker, mock_auth_header):
591591
mock_export_agent.return_value = agent_data
592592

593593
# Test with complex data
594-
response = edit_time_client.post(
594+
response = config_client.post(
595595
"/agent/export",
596596
json={"agent_id": 456},
597597
headers=mock_auth_header
@@ -620,7 +620,7 @@ async def test_export_agent_api_empty_response(mocker, mock_auth_header):
620620
mock_export_agent.return_value = {}
621621

622622
# Send request
623-
response = edit_time_client.post(
623+
response = config_client.post(
624624
"/agent/export",
625625
json={"agent_id": 789},
626626
headers=mock_auth_header
@@ -667,7 +667,7 @@ def test_get_agent_call_relationship_api_success(mocker, mock_auth_header):
667667
"tree": {"tools": [], "sub_agents": []}
668668
}
669669

670-
resp = edit_time_client.get("/agent/call_relationship/1", headers=mock_auth_header)
670+
resp = config_client.get("/agent/call_relationship/1", headers=mock_auth_header)
671671

672672
assert resp.status_code == 200
673673
mock_get_user_id.assert_called_once_with(mock_auth_header["Authorization"])
@@ -685,7 +685,7 @@ def test_get_agent_call_relationship_api_exception(mocker, mock_auth_header):
685685
mock_impl = mocker.patch("apps.agent_app.get_agent_call_relationship_impl")
686686
mock_impl.side_effect = Exception("boom")
687687

688-
resp = edit_time_client.get("/agent/call_relationship/999", headers=mock_auth_header)
688+
resp = config_client.get("/agent/call_relationship/999", headers=mock_auth_header)
689689

690690
assert resp.status_code == 500
691691
assert "Failed to get agent call relationship" in resp.json()["detail"]

0 commit comments

Comments
 (0)