Skip to content

Run import performance test also for v3 Locations#14404

Open
valentijnscholten wants to merge 9 commits intoDefectDojo:devfrom
valentijnscholten:performance-test-v3-updates
Open

Run import performance test also for v3 Locations#14404
valentijnscholten wants to merge 9 commits intoDefectDojo:devfrom
valentijnscholten:performance-test-v3-updates

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Feb 27, 2026

Summary

  • Add TestDojoImporterPerformanceSmallLocations with V3_FEATURE_LOCATIONS for v3 importer performance testing
  • Update update_performance_test_counts.py to support multiple test classes with identical method names
    • Extract class_name from FAIL header to scope updates to the correct class
    • Default to running both v2 and v3 classes when no --test-class is specified
    • Add process_class() helper to reduce duplication
  • Added instructions to CONTRIBUTING.md on how to automagically update the query counts after code changes
  • Fix BaseModelWithoutTimeMeta.save() default parameter skip_validation to evaluate at runtime instead of class definition time. The old code skip_validation: bool = not settings.V3_FEATURE_LOCATIONS baked in the value at import, causing full_clean() validation to be skipped when @override_settings(V3_FEATURE_LOCATIONS=True) was used in tests while the startup setting was False.

- Add TestDojoImporterPerformanceSmallLocations with V3_FEATURE_LOCATIONS
- Update update_performance_test_counts.py to run both v2 and v3 test classes
- Add --no-keepdb and EXTRA_ARGS to run-unittest.sh for test flexibility
@valentijnscholten valentijnscholten added this to the 2.56.0 milestone Feb 27, 2026
@valentijnscholten valentijnscholten changed the title Add v3 Locations performance test and update script support Run import performance test also for v3 Locations Feb 27, 2026
@github-actions github-actions bot added the docs label Feb 27, 2026
mtesauro
mtesauro previously approved these changes Feb 28, 2026
Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with the REST tests lately?

@valentijnscholten
Copy link
Member Author

The tests pass locally, but not GHA. Maybe let's wait for the locations code to settle down before merging this?

@valentijnscholten valentijnscholten marked this pull request as draft March 1, 2026 10:18
@Maffooch Maffooch modified the milestones: 2.56.0, 2.56.1 Mar 2, 2026
Extract class_name from FAIL header in test output instead of relying
on a test_class parameter. This correctly scopes method lookups to
the right class when v2 and v3 share identical method names.

- Add class_name field to TestCount (parsed from test output)
- Scope update_test_file by class_name to avoid cross-class matching
- Add process_class() helper to reduce duplication in main()
- Default to running both v2 and v3 classes when no --test-class given
@valentijnscholten valentijnscholten marked this pull request as ready for review March 8, 2026 17:56
Upstream optimizations reduced query counts across all v3 test methods.
Updated counts verified locally for both v2 and v3 test classes.
@valentijnscholten valentijnscholten marked this pull request as draft March 8, 2026 18:32
The default parameter `skip_validation = not settings.V3_FEATURE_LOCATIONS`
was evaluated once at class definition time (import). This caused different
query counts between local dev (V3=False at startup) and CI (V3=True at
startup), because @override_settings in tests could not affect the already
baked-in default. Changed to evaluate at runtime so full_clean() validation
runs correctly based on the active setting.
@valentijnscholten
Copy link
Member Author

Fixed it by making the new BaseModel respect the settings at runtime. The new full_clean stuff causes 100s of extra queries...

@valentijnscholten valentijnscholten marked this pull request as ready for review March 8, 2026 20:50
@valentijnscholten valentijnscholten removed this from the 2.56.1 milestone Mar 8, 2026
@valentijnscholten valentijnscholten added this to the 2.57.0 milestone Mar 8, 2026
@Maffooch Maffooch requested review from blakeaowens and dogboat March 9, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants