16
16
import requests # type: ignore
17
17
import splunklib .client as client # type: ignore
18
18
import tqdm # type: ignore
19
- from pydantic import (BaseModel , ConfigDict , Field , PrivateAttr ,
20
- computed_field , dataclasses )
19
+ from pydantic import (
20
+ BaseModel ,
21
+ ConfigDict ,
22
+ Field ,
23
+ PrivateAttr ,
24
+ computed_field ,
25
+ dataclasses ,
26
+ )
21
27
from semantic_version import Version
22
28
from splunklib .binding import HTTPError # type: ignore
23
29
from splunklib .results import JSONResultsReader , Message # type: ignore
24
30
from urllib3 import disable_warnings
25
31
26
32
from contentctl .actions .detection_testing .progress_bar import (
27
- FinalTestingStates , TestingStates , TestReportingType , format_pbar_string )
33
+ FinalTestingStates ,
34
+ TestingStates ,
35
+ TestReportingType ,
36
+ format_pbar_string ,
37
+ )
28
38
from contentctl .helper .utils import Utils
29
39
from contentctl .objects .base_test import BaseTest
30
40
from contentctl .objects .base_test_result import TestResultStatus
31
41
from contentctl .objects .config import All , Infrastructure , test_common
32
- from contentctl .objects .content_versioning_service import \
33
- ContentVersioningService
42
+ from contentctl .objects .content_versioning_service import ContentVersioningService
34
43
from contentctl .objects .correlation_search import CorrelationSearch , PbarData
35
44
from contentctl .objects .detection import Detection
36
45
from contentctl .objects .enums import AnalyticsType , PostTestBehavior
@@ -140,7 +149,9 @@ def setup(self):
140
149
self .start_time = time .time ()
141
150
142
151
# Init the list of setup functions we always need
143
- primary_setup_functions : list [tuple [Callable [[], None | client .Service ], str ]] = [
152
+ primary_setup_functions : list [
153
+ tuple [Callable [[], None | client .Service ], str ]
154
+ ] = [
144
155
(self .start , "Starting" ),
145
156
(self .get_conn , "Waiting for App Installation" ),
146
157
(self .configure_conf_file_datamodels , "Configuring Datamodels" ),
@@ -150,7 +161,7 @@ def setup(self):
150
161
(self .configure_imported_roles , "Configuring Roles" ),
151
162
(self .configure_delete_indexes , "Configuring Indexes" ),
152
163
(self .configure_hec , "Configuring HEC" ),
153
- (self .wait_for_ui_ready , "Finishing Primary Setup" )
164
+ (self .wait_for_ui_ready , "Finishing Primary Setup" ),
154
165
]
155
166
156
167
# Execute and report on each setup function
@@ -173,7 +184,7 @@ def setup(self):
173
184
TestReportingType .SETUP ,
174
185
self .get_name (),
175
186
"Beginning Content Versioning Validation..." ,
176
- set_pbar = False
187
+ set_pbar = False ,
177
188
)
178
189
)
179
190
for func , msg in self .content_versioning_service .setup_functions :
@@ -190,15 +201,15 @@ def setup(self):
190
201
msg = f"[{ self .get_name ()} ]: { str (e )} "
191
202
self .finish ()
192
203
if isinstance (e , ExceptionGroup ):
193
- raise ExceptionGroup (msg , e .exceptions ) from e # type: ignore
204
+ raise ExceptionGroup (msg , e .exceptions ) from e # type: ignore
194
205
raise Exception (msg ) from e
195
206
196
207
self .pbar .write (
197
208
self .format_pbar_string (
198
209
TestReportingType .SETUP ,
199
210
self .get_name (),
200
211
"Finished Setup!" ,
201
- set_pbar = False
212
+ set_pbar = False ,
202
213
)
203
214
)
204
215
@@ -220,7 +231,7 @@ def content_versioning_service(self) -> ContentVersioningService:
220
231
global_config = self .global_config ,
221
232
infrastructure = self .infrastructure ,
222
233
service = self .get_conn (),
223
- detections = self .sync_obj .inputQueue
234
+ detections = self .sync_obj .inputQueue ,
224
235
)
225
236
226
237
@property
@@ -251,7 +262,7 @@ def es_version(self) -> Version | None:
251
262
"""
252
263
if not self .es_installed :
253
264
return None
254
- return Version (self .get_conn ().apps [ES_APP_NAME ]["version" ]) # type: ignore
265
+ return Version (self .get_conn ().apps [ES_APP_NAME ]["version" ]) # type: ignore
255
266
256
267
@property
257
268
def es_installed (self ) -> bool :
@@ -400,7 +411,6 @@ def configure_imported_roles(
400
411
imported_roles : list [str ] = ["user" , "power" , "can_delete" ],
401
412
enterprise_security_roles : list [str ] = ["ess_admin" , "ess_analyst" , "ess_user" ],
402
413
):
403
-
404
414
# Set which roles should be configured. For Enterprise Security/Integration Testing,
405
415
# we must add some extra foles.
406
416
if self .global_config .enable_integration_testing :
0 commit comments