14
14
15
15
def run_test (add_db_command ):
16
16
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
20
32
try :
21
33
docker_pmm_client .check_output (add_db_command , timeout = 30 )
22
34
except AssertionError :
@@ -26,7 +38,7 @@ def run_test(add_db_command):
26
38
pmm_admin_list = json .loads (docker_pmm_client .check_output ('pmm-admin list --json' , timeout = 30 ))
27
39
for agent in pmm_admin_list ['agent' ]:
28
40
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' ]
30
42
agent_port = agent ['port' ]
31
43
break
32
44
try :
@@ -93,12 +105,14 @@ def test_ldap_auth_tls():
93
105
'--tls --tls-certificate-key-file=/mongodb_certs/client.pem --tls-ca-file=/mongodb_certs/ca-certs.pem '
94
106
'--cluster=mycluster' )
95
107
108
+ @pytest .mark .skip (reason = "Kerberos support in PMM was reverted" )
96
109
def test_kerberos_auth_wo_tls ():
97
110
run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 '
98
111
'--host=psmdb-server --port 27017 '
99
112
'--authentication-mechanism=GSSAPI --authentication-database=\' $external\' '
100
113
'--cluster=mycluster' )
101
114
115
+ @pytest .mark .skip (reason = "Kerberos support in PMM was reverted" )
102
116
def test_kerberos_auth_tls ():
103
117
run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 '
104
118
'--host=psmdb-server --port 27017 '
0 commit comments