1
1
import pymongo
2
2
import yaml
3
- from pytest import fixture , mark
4
-
5
- from kubetester import create_or_update_secret , try_load
3
+ from kubetester import create_or_update_secret , run_periodically , try_load
6
4
from kubetester .certs import create_mongodb_tls_certs , create_tls_certs
7
5
from kubetester .kubetester import KubernetesTester
8
6
from kubetester .kubetester import fixture as yaml_fixture
11
9
from kubetester .mongodb_user import MongoDBUser
12
10
from kubetester .omtester import skip_if_cloud_manager
13
11
from kubetester .phase import Phase
12
+ from mypyc .irbuild .function import check_native_override
13
+ from pytest import fixture , mark
14
14
from tests import test_logger
15
15
from tests .common .search import movies_search_helper
16
16
from tests .common .search .search_tester import SearchTester
@@ -192,16 +192,32 @@ def test_create_search_resource(mdbs: MongoDBSearch):
192
192
def test_wait_for_database_resource_ready (mdb : MongoDB ):
193
193
mdb .assert_reaches_phase (Phase .Running , timeout = 300 )
194
194
195
- for idx in range (mdb .get_members ()):
196
- mongod_config = yaml .safe_load (
197
- KubernetesTester .run_command_in_pod_container (
198
- f"{ mdb .name } -{ idx } " , mdb .namespace , ["cat" , "/data/automation-mongod.conf" ]
195
+
196
+ @mark .e2e_search_enterprise_tls
197
+ def test_wait_for_mongod_parameters (mdb : MongoDB ):
198
+ def check_mongod_parameters ():
199
+ parameters_are_set = True
200
+ pod_parameters = []
201
+ for idx in range (mdb .get_members ()):
202
+ mongod_config = yaml .safe_load (
203
+ KubernetesTester .run_command_in_pod_container (
204
+ f"{ mdb .name } -{ idx } " , mdb .namespace , ["cat" , "/data/automation-mongod.conf" ]
205
+ )
199
206
)
200
- )
201
- set_parameter = mongod_config .get ("setParameter" , {})
202
- assert (
203
- "mongotHost" in set_parameter and "searchIndexManagementHostAndPort" in set_parameter
204
- ), "mongot parameters not found in mongod config"
207
+ set_parameter = mongod_config .get ("setParameter" , {})
208
+ parameters_are_set = parameters_are_set and (
209
+ "mongotHost" in set_parameter and "searchIndexManagementHostAndPort" in set_parameter
210
+ )
211
+ pod_parameters .append (f"pod { idx } setParameter: { set_parameter } " )
212
+
213
+ return parameters_are_set , f'Not all pods have mongot parameters set:\n { "\n " .join (pod_parameters )} '
214
+
215
+ run_periodically (lambda : check_mongod_parameters (), timeout = 200 )
216
+
217
+
218
+ @mark .e2e_search_enterprise_tls
219
+ def test_wait_for_database_resource_ready2 (mdb : MongoDB ):
220
+ mdb .assert_reaches_phase (Phase .Running , timeout = 300 )
205
221
206
222
207
223
@mark .e2e_search_enterprise_tls
@@ -228,8 +244,8 @@ def test_search_assert_search_query(mdb: MongoDB):
228
244
class TestUpgradeMongod :
229
245
def test_check_polyfilled_role_in_ac (self , mdb : MongoDB ):
230
246
custom_roles = mdb .get_automation_config_tester ().automation_config .get ("roles" , [])
231
- assert ( len (custom_roles ) > 0 )
232
- assert ( "searchCoordinator" in [role ["role" ] for role in custom_roles ])
247
+ assert len (custom_roles ) > 0
248
+ assert "searchCoordinator" in [role ["role" ] for role in custom_roles ]
233
249
234
250
def test_mongod_version (self , mdb : MongoDB ):
235
251
mdb .tester (ca_path = get_issuer_ca_filepath (), use_ssl = True ).assert_version (MDB_VERSION_WITHOUT_BUILT_IN_ROLE )
@@ -241,12 +257,14 @@ def test_upgrade_to_mongo_8_2(self, mdb: MongoDB):
241
257
242
258
def test_check_polyfilled_role_not_in_ac (self , mdb : MongoDB ):
243
259
custom_roles = mdb .get_automation_config_tester ().automation_config .get ("roles" , [])
244
- assert ( len (custom_roles ) >= 0 )
245
- assert ( "searchCoordinator" not in [role ["role" ] for role in custom_roles ])
260
+ assert len (custom_roles ) >= 0
261
+ assert "searchCoordinator" not in [role ["role" ] for role in custom_roles ]
246
262
247
263
def test_mongod_version_after_upgrade (self , mdb : MongoDB ):
248
264
mdb_tester = mdb .tester (ca_path = get_issuer_ca_filepath (), use_ssl = True )
249
- mdb_tester .assert_scram_sha_authentication (ADMIN_USER_NAME , ADMIN_USER_PASSWORD , "SCRAM-SHA-256" , 1 , ssl = True , tlsCAFile = get_issuer_ca_filepath ())
265
+ mdb_tester .assert_scram_sha_authentication (
266
+ ADMIN_USER_NAME , ADMIN_USER_PASSWORD , "SCRAM-SHA-256" , 1 , ssl = True , tlsCAFile = get_issuer_ca_filepath ()
267
+ )
250
268
# TODO check why assert version works without auth for 8.0 and not for 8.2
251
269
mdb_tester .assert_version (MDB_VERSION_WITH_BUILT_IN_ROLE )
252
270
@@ -262,13 +280,19 @@ def get_connection_string(mdb: MongoDB, user_name: str, user_password: str) -> s
262
280
263
281
def get_admin_sample_movies_helper (mdb ):
264
282
return movies_search_helper .SampleMoviesSearchHelper (
265
- SearchTester (get_connection_string (mdb , ADMIN_USER_NAME , ADMIN_USER_PASSWORD ), use_ssl = True , ca_path = get_issuer_ca_filepath ())
283
+ SearchTester (
284
+ get_connection_string (mdb , ADMIN_USER_NAME , ADMIN_USER_PASSWORD ),
285
+ use_ssl = True ,
286
+ ca_path = get_issuer_ca_filepath (),
287
+ )
266
288
)
267
289
268
290
269
291
def get_user_sample_movies_helper (mdb ):
270
292
return movies_search_helper .SampleMoviesSearchHelper (
271
- SearchTester (get_connection_string (mdb , USER_NAME , USER_PASSWORD ), use_ssl = True , ca_path = get_issuer_ca_filepath ())
293
+ SearchTester (
294
+ get_connection_string (mdb , USER_NAME , USER_PASSWORD ), use_ssl = True , ca_path = get_issuer_ca_filepath ()
295
+ )
272
296
)
273
297
274
298
0 commit comments