test(tests): update test suite to align with isolation refactor and relative skill path
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ def mam_sandbox(tmp_path, monkeypatch):
|
||||
Also overrides environments (HOME, PATH, AGENT_SESSIONS_YAML, etc.) for isolation.
|
||||
"""
|
||||
# 1. Copy the skill scripts to sandboxed tmp_path/skills and tmp_path/.agents/skills
|
||||
src_skills = "/home/godopu16/PuKi/laa/canary_projects/multi-agent-mux/.agents/skills"
|
||||
src_skills = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".agents", "skills"))
|
||||
shutil.copytree(src_skills, tmp_path / "skills")
|
||||
shutil.copytree(src_skills, tmp_path / ".agents" / "skills")
|
||||
|
||||
|
||||
+12
-12
@@ -50,10 +50,10 @@ def test_create_derive_session_name_weird_characters(mam_sandbox):
|
||||
def test_create_isolation_lever(mam_sandbox):
|
||||
"""Test isolation_lever outputs for each supported agent."""
|
||||
agents = {
|
||||
"claude": "claude_config_dir",
|
||||
"cline": "cline_data_dir",
|
||||
"agy": "home",
|
||||
"hermes": "home",
|
||||
"claude": "none",
|
||||
"cline": "none",
|
||||
"agy": "none",
|
||||
"hermes": "none",
|
||||
"unknown": ""
|
||||
}
|
||||
for agent, expected in agents.items():
|
||||
@@ -65,11 +65,11 @@ def test_create_isolation_env_prefix(mam_sandbox):
|
||||
"""Test isolation_env_prefix format outputs."""
|
||||
res = run_lib_func(mam_sandbox, "isolation_env_prefix", "claude", "/tmp/iso")
|
||||
assert res.returncode == 0
|
||||
assert res.stdout == "CLAUDE_CONFIG_DIR=/tmp/iso "
|
||||
assert res.stdout == ""
|
||||
|
||||
res2 = run_lib_func(mam_sandbox, "isolation_env_prefix", "agy", "/tmp/iso")
|
||||
assert res2.returncode == 0
|
||||
assert res2.stdout == "HOME=/tmp/iso "
|
||||
assert res2.stdout == ""
|
||||
|
||||
res3 = run_lib_func(mam_sandbox, "isolation_env_prefix", "cline", "/tmp/iso")
|
||||
assert res3.returncode == 0
|
||||
@@ -79,7 +79,7 @@ def test_create_isolation_cmd_args(mam_sandbox):
|
||||
"""Test isolation_cmd_args format outputs."""
|
||||
res = run_lib_func(mam_sandbox, "isolation_cmd_args", "cline", "/tmp/iso")
|
||||
assert res.returncode == 0
|
||||
assert res.stdout == "--data-dir /tmp/iso"
|
||||
assert res.stdout == ""
|
||||
|
||||
res2 = run_lib_func(mam_sandbox, "isolation_cmd_args", "claude", "/tmp/iso")
|
||||
assert res2.returncode == 0
|
||||
@@ -105,14 +105,14 @@ def test_create_validate_env_key(mam_sandbox):
|
||||
# ==============================================================================
|
||||
|
||||
def test_resume_resolve_herdr_session_default(mam_sandbox):
|
||||
"""Test resolve_herdr_session fallback behavior when session is not in YAML."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_session", "non-existent-session")
|
||||
"""Test resolve_herdr_workspace fallback behavior when session is not in YAML."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_workspace", "non-existent-session")
|
||||
assert res.returncode == 0
|
||||
assert res.stdout.strip() == "default"
|
||||
assert res.stdout.strip() != ""
|
||||
|
||||
def test_resume_resolve_herdr_session_env(mam_sandbox):
|
||||
"""Test resolve_herdr_session fallback to HERDR_SERVER_NAME env var."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_session", "non-existent-session", env={"HERDR_SERVER_NAME": "custom_server"})
|
||||
"""Test resolve_herdr_workspace fallback to HERDR_SERVER_NAME env var."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_workspace", "non-existent-session", env={"HERDR_SERVER_NAME": "custom_server"})
|
||||
assert res.returncode == 0
|
||||
assert res.stdout.strip() == "custom_server"
|
||||
|
||||
|
||||
@@ -97,23 +97,14 @@ d['herdr_sessions'] = [
|
||||
assert "Duplicate running conversation ID" in res.stderr
|
||||
|
||||
def test_comp_create_isolation_folder_setup(mam_sandbox):
|
||||
"""Verify that provision_isolation correctly creates directories and symlinks."""
|
||||
"""Verify that provision_isolation runs cleanly as a stub for global config isolation."""
|
||||
lib_path = mam_sandbox / ".agents" / "skills" / "lib.sh"
|
||||
iso_root = mam_sandbox / "iso_home_test"
|
||||
|
||||
# Mock global claude credentials
|
||||
claude_cred = mam_sandbox / ".claude"
|
||||
claude_cred.mkdir(parents=True, exist_ok=True)
|
||||
(claude_cred / ".credentials.json").write_text('{"token": "xyz"}')
|
||||
|
||||
cmd_str = f"source {lib_path} && provision_isolation claude {iso_root}"
|
||||
res = subprocess.run(["bash", "-c", cmd_str], capture_output=True, text=True)
|
||||
assert res.returncode == 0
|
||||
|
||||
# Verify symlink exists and points to the credentials
|
||||
cred_sym = iso_root / ".credentials.json"
|
||||
assert cred_sym.is_symlink()
|
||||
assert cred_sym.read_text() == '{"token": "xyz"}'
|
||||
assert res.stdout == ""
|
||||
|
||||
def test_comp_create_sqlite_tables_created(mam_sandbox, mock_herdr, mock_agents):
|
||||
"""Verify that tables exist and contain records after a full create_session.sh run."""
|
||||
|
||||
Reference in New Issue
Block a user