test: fix test isolation in test_installed_api_no_duplicates_across_scenarios

Fix sequential scenario test that was failing in Env 9 due to improper
state management between scenarios.

Root Cause:
In scenario "CNR enabled + Nightly disabled":
1. Install Nightly → auto-disables CNR
2. Disable Nightly → both packages now disabled
3. Test expects: CNR enabled, Nightly disabled
4. Actual state: both disabled (CNR not re-enabled)

Fix:
Added enable operation after disabling Nightly to restore CNR to enabled state.
This ensures the scenario accurately represents "CNR enabled + Nightly disabled"
instead of leaving both packages disabled.

Changes:
- Added enable CNR operation after disabling Nightly in scenario 2
- Updated ui_id to be more descriptive (disable_nightly, enable_cnr)
- Ensures proper state transition: both enabled → Nightly disabled → CNR re-enabled

Test Results:
- Before: 9/10 environments passing (90%)
- After: 10/10 environments passing (100%)
- All 63 tests passing across all environments

Session Progress:
- Session start: 7/10 environments (60/63 tests)
- After parameter fix: 9/10 environments (62/63 tests)
- Final: 10/10 environments (63/63 tests )
- Total improvement: +3 environments, +3 tests (+42.9%)

🤖 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 15:22:02 +09:00
parent fb3a67f22c
commit b7a8f85530

View File

@ -299,7 +299,7 @@ def test_installed_api_no_duplicates_across_scenarios(
time.sleep(WAIT_TIME_MEDIUM) time.sleep(WAIT_TIME_MEDIUM)
elif scenario_id == "cnr_enabled_nightly_disabled": elif scenario_id == "cnr_enabled_nightly_disabled":
# Install Nightly then disable it # Install Nightly (this auto-disables CNR), then disable Nightly, then enable CNR
response = api_client.queue_task( response = api_client.queue_task(
kind="install", kind="install",
ui_id=f"test_{scenario_id}_nightly", ui_id=f"test_{scenario_id}_nightly",
@ -314,9 +314,10 @@ def test_installed_api_no_duplicates_across_scenarios(
assert response.status_code in [200, 201] assert response.status_code in [200, 201]
time.sleep(WAIT_TIME_MEDIUM) time.sleep(WAIT_TIME_MEDIUM)
# Disable Nightly
response = api_client.queue_task( response = api_client.queue_task(
kind="disable", kind="disable",
ui_id=f"test_{scenario_id}_disable", ui_id=f"test_{scenario_id}_disable_nightly",
params={"node_name": TEST_PACKAGE_ID}, params={"node_name": TEST_PACKAGE_ID},
) )
assert response.status_code == 200 assert response.status_code == 200
@ -324,6 +325,17 @@ def test_installed_api_no_duplicates_across_scenarios(
assert response.status_code in [200, 201] assert response.status_code in [200, 201]
time.sleep(WAIT_TIME_MEDIUM) time.sleep(WAIT_TIME_MEDIUM)
# Re-enable CNR (which was auto-disabled when Nightly was installed)
response = api_client.queue_task(
kind="enable",
ui_id=f"test_{scenario_id}_enable_cnr",
params={"cnr_id": TEST_PACKAGE_ID},
)
assert response.status_code == 200
response = api_client.start_queue()
assert response.status_code in [200, 201]
time.sleep(WAIT_TIME_MEDIUM)
elif scenario_id == "nightly_enabled_cnr_disabled": elif scenario_id == "nightly_enabled_cnr_disabled":
# CNR should already be disabled from previous scenario # CNR should already be disabled from previous scenario
# Enable Nightly (install if not exists) # Enable Nightly (install if not exists)