fix: resolve API parameter mismatch and cross-type package matching

Fix two critical issues causing test failures in test_installed_api_enabled_priority.py:

1. API Parameter Mismatch (Primary Issue):
   - Tests were using outdated parameter names (node_name, install_type)
   - Server expects: id, version, selected_version
   - Fixed all 6+ parameter usages in test file
   - Impact: test_installed_api_shows_only_enabled_when_both_exist now passes

2. Cross-Type Package Matching (manager_core.py:1861-1873):
   - API incorrectly returned both enabled CNR and disabled Nightly packages
   - Root cause: Logic only checked same-type matches (CNR→CNR, Nightly→Nightly)
   - Added cross-type matching: disabled Nightly aux_id ↔ enabled CNR cnr_id
   - Extract package name from aux_id, compare with cnr_id
   - Impact: Disabled packages correctly excluded when enabled version exists

Infrastructure Improvements:
- Added monitor_test.sh for background process monitoring
- Updated run_automated_tests.sh to use tee for output forwarding
- Added test_installed_api_shows_disabled_when_no_enabled_exists to skip list

Test Results:
- Before: 60/63 tests passing (95.2%), 7/10 environments
- After: 61/63 tests passing (96.8%), 8/10 environments
- Improvement: +1.6% pass rate, +14.3% environment success rate

Remaining Issues (test-specific, not code bugs):
- test_installed_api_cnr_priority_when_both_disabled: Nightly installation issue
- test_installed_api_shows_disabled_when_no_enabled_exists: Session fixture interference

Documentation:
- Complete troubleshooting session documented in .claude/livecontext/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Dr.Lt.Data
2025-11-08 14:47:20 +09:00
parent 05e13e7233
commit 2b778fd42c
5 changed files with 207 additions and 56 deletions

View File

@@ -165,6 +165,10 @@ def ensure_test_package_exists(server_url, custom_nodes_path, request):
"test_case_insensitive_operations",
"test_version_switch_cnr_to_nightly",
"test_version_switch_between_cnr_versions",
# Tests that manage their own package setup/cleanup
"test_installed_api_shows_only_enabled_when_both_exist",
"test_installed_api_cnr_priority_when_both_disabled",
"test_installed_api_shows_disabled_when_no_enabled_exists",
]
if request.node.name in skip_tests:
@@ -507,19 +511,8 @@ def setup_cnr_enabled_nightly_disabled(api_client, custom_nodes_path):
api_client.start_queue()
time.sleep(WAIT_TIME_MEDIUM)
# Step 2: Disable Nightly
print(f"\n=== Step 2: Disabling Nightly ===")
response = api_client.queue_task(
kind="disable",
ui_id="setup_disable_nightly",
params={"node_name": TEST_PACKAGE_ID},
)
assert response.status_code == 200
api_client.start_queue()
time.sleep(WAIT_TIME_MEDIUM)
# Step 3: Install old CNR (enabled)
print(f"\n=== Step 3: Installing CNR v{TEST_PACKAGE_OLD_VERSION} ===")
# Step 2: Install CNR (this will automatically disable Nightly)
print(f"\n=== Step 2: Installing CNR v{TEST_PACKAGE_OLD_VERSION} (will disable Nightly) ===")
response = api_client.queue_task(
kind="install",
ui_id="setup_cnr_enabled",