Skip to content

Commit 48800bb

Browse files
committed
functions - fix setting replica_set in run_mongo
1 parent f17b14a commit 48800bb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

e2e-tests/functions

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ run_mongo() {
705705
local suffix=${4:-.svc.cluster.local}
706706
local client_container=$(kubectl_bin get pods --selector=name=psmdb-client -o 'jsonpath={.items[].metadata.name}')
707707
local mongo_flag="$5"
708-
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)\..*/\1/')
708+
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)(\.|-).*/\1/')
709709

710710
kubectl_bin exec ${client_container} -- \
711711
bash -c "printf '$command\n' | mongo $driver://$uri$suffix/admin?ssl=false\&replicaSet=$replica_set $mongo_flag"
@@ -719,7 +719,7 @@ run_mongo_tls() {
719719
local suffix=${4:-.svc.cluster.local}
720720
local client_container=$(kubectl_bin get pods --selector=name=psmdb-client -o 'jsonpath={.items[].metadata.name}')
721721
local mongo_flag="$5"
722-
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)\..*/\1/')
722+
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)(\.|-).*/\1/')
723723

724724
kubectl_bin exec ${client_container} -- \
725725
bash -c "printf '$command\n' | mongo $driver://$uri$suffix/admin?replicaSet=$replica_set --tls --tlsCAFile /etc/mongodb-ssl/ca.crt --tlsCertificateKeyFile /tmp/tls.pem --tlsAllowInvalidHostnames $mongo_flag"
@@ -1119,6 +1119,9 @@ kubectl_bin() {
11191119
cat "$LAST_OUT"
11201120
cat "$LAST_ERR" >&2
11211121
rm "$LAST_OUT" "$LAST_ERR"
1122+
if [ ${exit_status} != 0 ]; then
1123+
collect_k8s_logs
1124+
fi
11221125
return ${exit_status}
11231126
}
11241127

0 commit comments

Comments
 (0)