test(integration): update test_tier3_integration to align with global config-home convention

This commit is contained in:
2026-08-07 11:01:33 +09:00
parent 1658af41e7
commit 9f266e6bd6
+6 -15
View File
@@ -63,7 +63,7 @@ def test_integration_create_options_combination(mam_sandbox, mock_herdr, mock_ag
session = sessions[0] session = sessions[0]
assert session["role"] == "Creator" assert session["role"] == "Creator"
assert session.get("herdr_session") == "custom_server" assert session.get("herdr_server") == "custom_server"
assert session["delegate_job_id"] is not None assert session["delegate_job_id"] is not None
assert session["status"] == "running" assert session["status"] == "running"
@@ -98,26 +98,20 @@ def test_integration_stop_purge_combination(mam_sandbox, mock_herdr, mock_agents
res_create = subprocess.run(cmd_create, capture_output=True, text=True, cwd=str(tmp_path)) res_create = subprocess.run(cmd_create, capture_output=True, text=True, cwd=str(tmp_path))
assert res_create.returncode == 0, f"Stdout: {res_create.stdout}\nStderr: {res_create.stderr}" assert res_create.returncode == 0, f"Stdout: {res_create.stdout}\nStderr: {res_create.stderr}"
# Get session name and isolation uuid # Get session name and claude session uuid
yaml_path = tmp_path / ".mam" / "agent-sessions.yaml" yaml_path = tmp_path / ".mam" / "agent-sessions.yaml"
with open(yaml_path, 'r') as f: with open(yaml_path, 'r') as f:
reg = yaml.safe_load(f) reg = yaml.safe_load(f)
session = reg["herdr_sessions"][0] session = reg["herdr_sessions"][0]
session_name = session["name"] session_name = session["name"]
iso_uuid = session["isolation"]["uuid"] claude_uuid = session["claude_session_id_own"]
iso_root = Path(session["isolation"]["root"])
# Ensure isolation home root folder is provisioned
assert iso_root.exists()
# Locate dynamically generated conversation file in claude projects # Locate dynamically generated conversation file in claude projects
key = str(tmp_path).replace('/', '-').replace('_', '-') key = str(tmp_path).replace('/', '-').replace('_', '-')
proj_dir = iso_root / "projects" / key proj_dir = tmp_path / ".claude" / "projects" / key
assert proj_dir.exists(), f"Expected isolated projects directory {proj_dir} to exist" assert proj_dir.exists(), f"Expected projects directory {proj_dir} to exist"
jsonls = list(proj_dir.glob("*.jsonl")) jsonl_file = proj_dir / f"{claude_uuid}.jsonl"
assert len(jsonls) == 1, f"Expected exactly 1 jsonl file in {proj_dir}, found {jsonls}"
jsonl_file = jsonls[0]
assert jsonl_file.exists() assert jsonl_file.exists()
# Update mock herdr's state to match the running agent so the stop kill-chain works gracefully # Update mock herdr's state to match the running agent so the stop kill-chain works gracefully
@@ -147,7 +141,6 @@ def test_integration_stop_purge_combination(mam_sandbox, mock_herdr, mock_agents
assert "DANGER: --purge-conversation" in res_stop_no_yes.stdout assert "DANGER: --purge-conversation" in res_stop_no_yes.stdout
# Ensure nothing was deleted yet # Ensure nothing was deleted yet
assert iso_root.exists()
assert jsonl_file.exists() assert jsonl_file.exists()
# 3. Run stop_session with --yes # 3. Run stop_session with --yes
@@ -161,8 +154,6 @@ def test_integration_stop_purge_combination(mam_sandbox, mock_herdr, mock_agents
assert res_stop_yes.returncode == 0, f"Stdout: {res_stop_yes.stdout}\nStderr: {res_stop_yes.stderr}" assert res_stop_yes.returncode == 0, f"Stdout: {res_stop_yes.stdout}\nStderr: {res_stop_yes.stderr}"
# Assertions: # Assertions:
# - Isolation directory deleted
assert not iso_root.exists()
# - Conversation files deleted # - Conversation files deleted
assert not jsonl_file.exists() assert not jsonl_file.exists()
# - Session completely removed from YAML/DB registry # - Session completely removed from YAML/DB registry