1414
1515def run_test (add_db_command ):
1616 try :
17- docker_pmm_client .check_output ('pmm-admin remove mongodb psmdb-server' , timeout = 30 )
18- except AssertionError :
19- pass
17+ output = docker_pmm_client .check_output ('pmm-admin list --json' , timeout = 30 )
18+ services_info = json .loads (output )
19+ except (AssertionError , json .JSONDecodeError ):
20+ pytest .fail ("Failed to get or parse service list from pmm-admin" )
21+ services_to_remove = []
22+ for service in services_info .get ("service" , []):
23+ service_type = service .get ("service_type" )
24+ service_name = service .get ("service_name" , "" )
25+ if service_type == "SERVICE_TYPE_MONGODB_SERVICE" and service_name .startswith ("psmdb-server" ):
26+ services_to_remove .append (service_name )
27+ for service_name in services_to_remove :
28+ try :
29+ docker_pmm_client .check_output (f'pmm-admin remove mongodb { service_name } ' , timeout = 30 )
30+ except AssertionError :
31+ pass
2032 try :
2133 docker_pmm_client .check_output (add_db_command , timeout = 30 )
2234 except AssertionError :
@@ -26,7 +38,7 @@ def run_test(add_db_command):
2638 pmm_admin_list = json .loads (docker_pmm_client .check_output ('pmm-admin list --json' , timeout = 30 ))
2739 for agent in pmm_admin_list ['agent' ]:
2840 if agent ['agent_type' ] == 'AGENT_TYPE_MONGODB_EXPORTER' :
29- agent_id = "mypass"
41+ agent_id = "mypass" if "GSSAPI" not in add_db_command else agent [ 'agent_id' ]
3042 agent_port = agent ['port' ]
3143 break
3244 try :
@@ -93,12 +105,14 @@ def test_ldap_auth_tls():
93105 '--tls --tls-certificate-key-file=/mongodb_certs/client.pem --tls-ca-file=/mongodb_certs/ca-certs.pem '
94106 '--cluster=mycluster' )
95107
108+ @pytest .mark .skip (reason = "Kerberos support in PMM was reverted" )
96109def test_kerberos_auth_wo_tls ():
97110 run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 ' 98111 '--host=psmdb-server --port 27017 '
99112 '--authentication-mechanism=GSSAPI --authentication-database=\' $external\' '
100113 '--cluster=mycluster' )
101114
115+ @pytest .mark .skip (reason = "Kerberos support in PMM was reverted" )
102116def test_kerberos_auth_tls ():
103117 run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 ' 104118 '--host=psmdb-server --port 27017 '
0 commit comments