KUBE-180: validate MongoDBSearch lifecycle recovery#1383
Conversation
4fe0b46 to
6298544
Compare
9e05f7b to
7787462
Compare
6298544 to
c2877b0
Compare
7787462 to
79421f8
Compare
c2877b0 to
a0f1469
Compare
79421f8 to
90e0eae
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
a0f1469 to
752df7e
Compare
| ), f"expected at least one mongot data PVC for {names['sts']} before delete" | ||
|
|
||
|
|
||
| def wait_for_search_artifacts_deleted( |
There was a problem hiding this comment.
Systemic tightening for all four cleanup tests: every absence check in this helper (and its callers) is by exact resource NAME. An orphan the operator leaves under an unexpected name — e.g. a stale TLS copy from a previous UID, or a legacy-named leftover — is invisible to every cleanup assertion in the stack. Adding one list-by-label-selector (mongodb.com/search-name=<name> [+ uid]) emptiness check per kind at the end of this helper closes that hole globally.
|
|
||
|
|
||
| @mark.e2e_search_community_basic | ||
| def test_search_statefulset_restores_removed_owner_label(namespace: str, mdbs: MongoDBSearch): |
There was a problem hiding this comment.
This waits only for the stripped mongodb.com/search-name label to return. A regression where the reapply restores that one label but drops search-uid/component or clobbers the custom user label would pass. After restoration, re-read once and assert the full protected set + CUSTOM_STATEFULSET_LABEL are all intact (reuse the tuple from the coexistence test above). Also 300s is generous for a next-reconcile reapply; 60-90s would catch latency regressions.
| if pvc.metadata.name.startswith(prefix) | ||
| ] | ||
| @mark.e2e_search_community_basic | ||
| def test_recreate_mongot_top_level_resources( |
There was a problem hiding this comment.
Recreated objects are validated by UID-change + readiness, but never re-checked for protected labels. A self-heal that recreates the STS without the owner labels (breaking future sweep/routing) passes. One extra assert on the recreated resources' labels closes it — same applies to the q2 and simulated-MC recreation tests.
| f"operator-managed TLS secret {operator_tls_secret} in {target_cluster_name}", | ||
| timeout=600, | ||
| ) | ||
| wait_for_mongot_pvcs_deleted(namespace, sts_name, api_client=target_cluster.api_client, timeout=300) |
There was a problem hiding this comment.
Cross-talk gap: after deleting named_single, the test never re-asserts that mdbs's resources survived the sweep — the core 'label-scoped delete of CR A must not touch CR B' claim is only implicit in later tests. Re-read mdbs's STS/Envoy/TLS-secret here and assert present with unchanged UIDs.
| status = mdbs.get_metrics_forwarder_status() | ||
| return status is not None and status.get("phase") == Phase.Running.name | ||
|
|
||
| run_periodically(metrics_forwarder_running, timeout=120, interval=10) |
There was a problem hiding this comment.
run_periodically reads sleep_time=, not interval= — this kwarg is silently ignored and it polls every 2s. Harmless (still bounded) but copied from the pre-existing interval= sites in this file; worth fixing to sleep_time=10 (and adding msg=) here and in the siblings.
|
Coverage-gap audit (from the stack review; ranked by customer risk). P0 — cheap, kind-testable, should be scheduled: (1) same-name delete→immediate-recreate of a Search (the UID adopt/reset path is a headline layer-1 behavior with zero e2e today); (2) disable-reconciliation annotation honored during delete-cleanup (fail-open if wrong). P1: upgrade e2e asserting legacy owner-ref removal + label backfill post-upgrade; CR-delete while operator is scaled to 0 → cleanup on restart; restart mid-deletion (sweep resume); MC member-cluster removal sweep (drop a |
Jira: KUBE-180
Stack
Stack 3/4, based on #1382 (
search-kube154-cleanup-self-healing) at accepted head90e0eae8c5226ee8cb1259260aaf1d39fa675b3d(treee3b69354fa29f1466222ec1f138fe2315bd26455). #1382 is stacked on #1362.Head:
search-kube154-lifecycle-e2eat752df7eb5a0fa78512745f3696350bc4f18b6ba7(tree3ea52f6c8db276e45e4b15edaa68b7e6dd736644).Commits
ebd8a55de8b9cf09c59128b7daca0324973ae2ac—KUBE-154: cover single-cluster Search lifecycle recoverydocker/mongodb-kubernetes-tests/tests/common/search/connectivity.pydocker/mongodb-kubernetes-tests/tests/common/search/search_resource_names.pydocker/mongodb-kubernetes-tests/tests/search/search_community_basic.pydocker/mongodb-kubernetes-tests/tests/search/search_enterprise_metrics_forwarder_replicaset.pydocker/mongodb-kubernetes-tests/tests/search/search_external_metrics_forwarder_replicaset.pydocker/mongodb-kubernetes-tests/tests/search/search_sharded_scale_shards_managed_lb.py752df7eb5a0fa78512745f3696350bc4f18b6ba7—KUBE-154: cover multi-cluster Search lifecycle recoverydocker/mongodb-kubernetes-tests/kubetester/operator.pydocker/mongodb-kubernetes-tests/tests/common/search/connectivity.pydocker/mongodb-kubernetes-tests/tests/common/search/search_resource_names.pydocker/mongodb-kubernetes-tests/tests/multicluster_search/q2_mc_rs_steady.pydocker/mongodb-kubernetes-tests/tests/multicluster_search/simulated_mc_rs.pyBoth commits retain the required Copilot co-author trailer. Their stable patch IDs remain
dbeb4f0474c69857fbfc138719189fc5e2a750e2and2f2e1b4ae74ef602203725898c9616e3ebf44833, matching the reviewed logical commits exactly.Scope
Non-scope
.evergreen.ymlchanges.tests/conftest.pychanges.Local validation
NAMESPACE=collect-only uvx --offline --with-requirements ../../requirements.txt ty check tests/passed; focused collection found 66 tests; existing Python tests passed 116 withscripts/release/tests/release_info_test.py::test_create_release_info_jsondeselected because it requires a Docker daemon; kubeobject passed 27.Evergreen
Final-base exhaustive patch
6a5a466cd981fd0007360290is terminal. Its scope was inspected before activation and exactly matched the executable matrix: 57 requested targets across nine variants (all 56 executable Search targets plusunit_tests_golang) and 12 required dependencies, 69 tasks total. The result is 68 successes and one accepted deterministic failure: 56/57 requested targets and 12/12 dependencies succeeded.e2e_mdb_kind_ubi_cloudqa_largee2e_mdb_kind_ubi_cloudqa_search_blocke2e_search_block_multi_clustere2e_mdb_openshift_search_ubi_cloudqae2e_search_sharded_openshift_externale2e_om80_kind_ubi_largee2e_multi_cluster_kinde2e_multi_cluster_2_clusterse2e_operator_kind_ubi_cloudqae2e_operator_upgrade_searchprivate_kind_code_snippetstest_kind_search_*.shtasksunit_testsunit_tests_golange2e_operator_upgrade_searchfailed executions 0 and 1 identically inTestOperatorUpgrade.test_database_running_after_upgradeafter 300 seconds. In both executions,mdb-rs-2remained at automation goal@-1whilemdb-rs-0andmdb-rs-1reached version 9. Search creation/query before upgrade, Search Running after upgrade, and mongot-version verification before and after upgrade all passed. This is the accepted pinned-GA/upgrade-fixture gap owned by Layer 4, not a Layer-3 lifecycle regression or infrastructure flake; no focused retry or Layer-3 change was made. Logs, test URLs, health snapshots, and both complete artifact bundles are preserved for Layer 4.e2e_search_connectivity_tool_mc_shardedwas included as an executable Search target and succeeded. Temporary patch-only activation was submitted only as uncommitted patch input and removed immediately; the branch remained clean.Patch
6a5a382de34979000766218cused the superseded 56-request matrix and was canceled as non-evidence when the executable task set was corrected. Earlier patches6a59e82a3ea0260007c2ee32,6a589eb5586dd5000775cc0d,6a583b98586dd5000773a9b9, and6a587a6cf6311c00071550bfare also superseded and are not final validation evidence. Broad webhook patch6a5a535d8f3f36000727c151was canceled immediately and is non-evidence.skip-ci