Skip to content

Commit fdcf12b

Browse files
authored
K8SPSMDB-1316: add pmm.customClusterName e2e-test (#1891)
1 parent c5c0dde commit fdcf12b

File tree

1 file changed

+23
-0
lines changed
  • e2e-tests/monitoring-2-0

1 file changed

+23
-0
lines changed

e2e-tests/monitoring-2-0/run

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ does_node_id_exists() {
2525
echo "${nodeList_from_pmm[@]}"
2626
}
2727

28+
check_custom_cluster_name() {
29+
local pod_service_name=$1
30+
local pmm_services_file=$2
31+
32+
echo "Checking $pod_service_name"
33+
pmm_service_cluster=$(jq -r '.mongodb[] | select(.service_name=='\"$pod_service_name\"') | .cluster' $pmm_services_file)
34+
if [[ $custom_name != $pmm_service_cluster ]]; then
35+
echo "Not custom CLUSTER_NAME was used for pmm-client. Cluster in pmm: $pmm_service_cluster. customClusterName: $custom_name"
36+
exit 1
37+
fi
38+
}
39+
2840
create_infra $namespace
2941
deploy_cert_manager
3042

@@ -141,6 +153,17 @@ for instance in "${does_node_id_exists_in_pmm[@]}"; do
141153
fi
142154
done
143155

156+
desc 'check customClusterName for pmm'
157+
custom_name="custom-cluster-name"
158+
kubectl_bin patch psmdb ${cluster} --type json -p='[{"op":"add","path":"/spec/pause","value":false}, {"op":"add","path":"/spec/pmm/customClusterName","value":'$custom_name'}]'
159+
wait_for_running $cluster-rs0 3
160+
161+
# get services list from pmm server
162+
curl -s -k -d '{"service_type":"MONGODB_SERVICE"}' "https://admin:admin@"$(get_service_endpoint monitoring-service)"/v1/inventory/Services/List" >${tmp_dir}/pmm_service_list.json
163+
check_custom_cluster_name ${namespace}-${cluster}-mongos-0 ${tmp_dir}/pmm_service_list.json
164+
check_custom_cluster_name ${namespace}-${cluster}-rs0-0 ${tmp_dir}/pmm_service_list.json
165+
check_custom_cluster_name ${namespace}-${cluster}-cfg-0 ${tmp_dir}/pmm_service_list.json
166+
144167
if [[ -n ${OPENSHIFT} ]]; then
145168
oc adm policy remove-scc-from-user privileged -z pmm-server
146169
if [ -n "$OPERATOR_NS" ]; then

0 commit comments

Comments
 (0)