@@ -38,9 +38,22 @@ class TestDojoImporterPerformance(DojoTestCase):
3838
3939 def setUp (self ):
4040 super ().setUp ()
41+
4142 self .system_settings (enable_webhooks_notifications = False )
4243 self .system_settings (enable_product_grade = False )
4344 self .system_settings (enable_github = False )
45+ # from dojo.models import System_Settings
46+
47+ # # Configure system settings directly
48+ # from dojo.middleware import DojoSytemSettingsMiddleware
49+ # from dojo.models import System_Settings
50+ # system_settings = System_Settings.objects.get()
51+ # system_settings.enable_product_tag_inheritance = True
52+ # system_settings.save()
53+
54+ # Initialize middleware with modified settings
55+ # DojoSytemSettingsMiddleware.initialize_for_testing(System_Settings.objects.get())
56+
4457 # Warm up ContentType cache for relevant models. This is needed if we want to be able to run the test in isolation
4558 # As part of the test suite the ContentTYpe ids will already be cached and won't affect the query count.
4659 # But if we run the test in isolation, the ContentType ids will not be cached and will result in more queries.
@@ -106,6 +119,8 @@ def import_reimport_performance(self, expected_num_queries1, expected_num_async_
106119 "sync" : True ,
107120 "scan_type" : STACK_HAWK_SCAN_TYPE ,
108121 "engagement" : engagement ,
122+ "tags" : ["performance-test" , "tag-in-param" , "go-faster" ],
123+ "apply_tags_to_findings" : True ,
109124 }
110125 importer = DefaultImporter (** import_options )
111126 test , _ , _len_new_findings , _len_closed_findings , _ , _ , _ = importer .process_scan (scan )
@@ -127,6 +142,8 @@ def import_reimport_performance(self, expected_num_queries1, expected_num_async_
127142 "verified" : True ,
128143 "sync" : True ,
129144 "scan_type" : STACK_HAWK_SCAN_TYPE ,
145+ "tags" : ["performance-test-reimport" , "reimport-tag-in-param" , "reimport-go-faster" ],
146+ "apply_tags_to_findings" : True ,
130147 }
131148 reimporter = DefaultReImporter (** reimport_options )
132149 test , _ , _len_new_findings , _len_closed_findings , _ , _ , _ = reimporter .process_scan (scan )
@@ -154,11 +171,11 @@ def import_reimport_performance(self, expected_num_queries1, expected_num_async_
154171
155172 def test_import_reimport_reimport_performance (self ):
156173 self .import_reimport_performance (
157- expected_num_queries1 = 603 ,
174+ expected_num_queries1 = 712 ,
158175 expected_num_async_tasks1 = 15 ,
159- expected_num_queries2 = 489 ,
176+ expected_num_queries2 = 656 ,
160177 expected_num_async_tasks2 = 23 ,
161- expected_num_queries3 = 347 ,
178+ expected_num_queries3 = 332 ,
162179 expected_num_async_tasks3 = 20 ,
163180 )
164181
@@ -172,12 +189,12 @@ def test_import_reimport_reimport_performance_no_async(self, mock):
172189 so we patch the we_want_async decorator to always return False.
173190 """
174191 self .import_reimport_performance (
175- expected_num_queries1 = 673 ,
176- expected_num_async_tasks1 = 25 ,
177- expected_num_queries2 = 544 ,
178- expected_num_async_tasks2 = 30 ,
179- expected_num_queries3 = 387 ,
180- expected_num_async_tasks3 = 25 ,
192+ expected_num_queries1 = 712 ,
193+ expected_num_async_tasks1 = 15 ,
194+ expected_num_queries2 = 656 ,
195+ expected_num_async_tasks2 = 23 ,
196+ expected_num_queries3 = 332 ,
197+ expected_num_async_tasks3 = 20 ,
181198 )
182199
183200 @patch ("dojo.decorators.we_want_async" , return_value = False )
@@ -190,11 +207,12 @@ def test_import_reimport_reimport_performance_no_async_with_product_grading(self
190207 so we patch the we_want_async decorator to always return False.
191208 """
192209 self .system_settings (enable_product_grade = True )
210+
193211 self .import_reimport_performance (
194- expected_num_queries1 = 673 ,
212+ expected_num_queries1 = 752 ,
195213 expected_num_async_tasks1 = 25 ,
196- expected_num_queries2 = 544 ,
214+ expected_num_queries2 = 690 ,
197215 expected_num_async_tasks2 = 30 ,
198- expected_num_queries3 = 387 ,
216+ expected_num_queries3 = 357 ,
199217 expected_num_async_tasks3 = 25 ,
200218 )
0 commit comments