Repository navigation
test: fix order-dependent and stale tests surfaced by the full suite run - #3681
Merged
Merged
Conversation
Full run-full.sh on a local stack (pytest-randomly installed, so test order is shuffled) failed several tests that pass in isolation. None of these are product bugs; each fix is test-side. Integration/API tier: - Default-state tests (Nevermined no-config x2, shared-folders defaults, read-only default) asserted "fresh agent" state on the module-scoped created_agent that sibling tests mutate. They now use isolated_agent. - test_rename_agent_name_sanitization renamed to a fixed name. A deleted agent's soft-deleted ownership row keeps that name and its volume base reserved by design (#1664/#1671), so every run after the first got 409. The target is now derived from the fixture agent's unique suffix. - TestSubscriptionAutoAssign round-robin/tiebreak: since #2409 auto-assign ranks by cached headroom, so a real operator subscription always beats the suite's fake tokens. Skip on foreign subscriptions like the existing no-subscription test (#2420); the tiebreak subs now carry the suite prefix. - test_respond_to_pending_item: answering a platform-raised item lands `acknowledged` (#2372); pin both shapes. Unit tier (fixed at the polluter, not the victim): - test_brain_orb_postprocess: a lazily imported task_execution_service bound the patched database.db stub; pre-import it before each patch. - test_monitoring_dormant_skip: bare sys.modules assignment of a stub services.monitoring_alerts; use monkeypatch.setitem. - test_subscription_auto_switch_no_cred_import: restore the parent-package attribute as well as the sys.modules slot. - test_ec_loop_service_edges m16: the [postgres] variant fails on the known float4 REAL-column bug, not pollution; strict xfail citing #3441. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A full
tests/run-full.shrun on a local stack failed several tests that pass when run alone. Every one of them is a test-side problem: order dependence (pytest-randomly shuffles the order when it is installed), state that leaks between tests, or an assertion that went stale after an intended product change. This PR fixes them in the tests only. No product code changes.The two real product bugs from the same run were filed separately as #3676 and #3677.
Integration / API tier
test_nevermined_permissions.py::test_get_config_no_config,test_nevermined_payments.py::test_info_no_config,test_shared_folders.py::test_folders_default_values,test_read_only_mode.py::test_get_read_only_status_default_is_disabledcreated_agent, which sibling tests change. Under a shuffled order the change can come first.isolated_agentfixture.test_agent_rename.py::test_rename_agent_name_sanitizationtest-agent-with-spaces. Deleting the renamed agent soft-deletes its ownership row, and that row keeps reserving the name and its volume base by design (#1664/#1671). Every run after the first got 409.test_subscriptions.py::TestSubscriptionAutoAssignround-robin and tiebreaktest-prefix.test_operator_queue.py::test_respond_to_pending_itemacknowledged, notresponded(#2372). The test picks whichever pending row comes first.acknowledgedmust also setacknowledged_at.Unit tier
Each fix is in the test that leaked state, not in the test that failed.
test_ent814_served_seat.pytest_brain_orb_postprocess.py:dispatch_postprocesslazily importstask_execution_servicewhiledatabase.dbis patched. The unit conftest evicts that module after each test, so its fresh import bound the stub.test_2973_depth_new_roots.pytest_monitoring_dormant_skip.py: a baresys.modules["services.monitoring_alerts"] = stubthat was never undone.monkeypatch.setitem.test_2572_credentialless_adoption.py(apply-phase restarts)test_subscription_auto_switch_no_cred_import.py: the restore fixture fixed thesys.modulesslot but left a stale module on the parent package attribute. The victim then patched the wrong copy of_restart_agent.test_ec_loop_service_edges.py::test_m16_infinite_budget_never_trips[postgres]NumericValueOutOfRange. That is the known bug #3441.Test plan
-p no:randomly.-p randomlywith seeds 1, 7, 42, 12345, 987654 and 2026:188 passed, 1 xfailedeach time.-p randomly. Seed 1 gave149 passed, 3 skipped. Seed 424242 had one transientReadTimeouton the first run and gave149 passed, 3 skippedon the re-run.[postgres]xfail was not executed locally, because it needs the disposable Postgres tier.The 3 skips are the subscription precondition guard. They fire because the test stack has a real operator subscription.
🤖 Generated with Claude Code