Skip to content

Commit 76a2323

Browse files
test: pin query-count baselines for tag inheritance hot paths (#14811)
* test: pin query-count baselines for tag inheritance hot paths Adds unittests/test_tag_inheritance_perf.py with assertNumQueries baselines on the six hottest tag inheritance paths (Product tag add/remove propagating to N findings, child create under inheritance, sticky enforcement on child tag edits). Numbers are pinned against current `dev` behavior so subsequent optimization work shows up as concrete query-count reductions instead of relying on manual benchmarking. The class is intentionally temporary: pins move down as the redesign work lands and the file can be deleted once the targets are met. * test: add Endpoint (V2) and Location (V3) propagation baselines Extends the perf test class with two more pinned hot paths so all child models exercised by `propagate_tags_on_product_sync` are covered: product_tag_add -> 100 endpoints (V2) : 3958 product_tag_remove -> 100 endpoints (V2): 3740 product_tag_add -> 100 locations (V3) : 4532 product_tag_remove -> 100 locations (V3): 4307 Both V2 and V3 paths run regardless of the ambient `V3_FEATURE_LOCATIONS` setting via per-test `@override_settings(...)`. CI matrix runs the suite in both modes, so dynamic pin selection (`_pin(v2=..., v3=...)`) handles the small per-mode count differences on the existing finding tests. * test: add ZAP import/reimport baselines + V2/V3 variants for every scenario Two additions: 1. New TagInheritanceImportPerfBaselines class pins query counts for the importer hot path (production's heaviest tag-inheritance scenario). Both first-import and no-change-reimport are covered, each with V2 and V3 method variants: zap_import_v2 : 1461 zap_import_v3 : 1319 zap_reimport_no_change_v2 : 77 zap_reimport_no_change_v3 : 95 2. Restructures the existing baseline class so every scenario has both a _v2 and _v3 method variant via per-test @override_settings. The whole suite now runs both modes in a single invocation; no need to run twice with different DD_V3_FEATURE_LOCATIONS env. Phase A leaves the importer numbers ~unchanged (importer hot loop is creation-driven, not the bulk-propagation path Phase A targets). Phase B's tag_inheritance.batch() context manager is the lever that lowers these numbers. * test: warm ContentType cache in tag inheritance perf baselines First V3 Location op in the class paid a one-time ContentType lookup, producing a matrix-dependent off-by-one (V3-default-on CI: 4531; V3-default-off CI + local: 4532). Match the warm-up pattern used in test_importers_performance and pin EXPECTED_PRODUCT_TAG_ADD_100_LOCATIONS to the post-warm value (4531).
1 parent 5244e7a commit 76a2323

1 file changed

Lines changed: 494 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)