Skip to content

Commit 384c699

Browse files
committed
functions - fix setting replica_set in run_mongo
1 parent 20850d9 commit 384c699

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
@@ -720,7 +720,7 @@ run_mongo() {
720720
local suffix=${4:-.svc.cluster.local}
721721
local client_container=$(kubectl_bin get pods --selector=name=psmdb-client -o 'jsonpath={.items[].metadata.name}')
722722
local mongo_flag="$5"
723-
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)\..*/\1/')
723+
local replica_set=$(echo "$uri" | sed -r 's/.*\-(rs[0-9]|cfg)(\.|-).*/\1/')
724724

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

739739
kubectl_bin exec ${client_container} -- \
740740
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"
@@ -1142,6 +1142,9 @@ kubectl_bin() {
11421142
cat "$LAST_OUT"
11431143
cat "$LAST_ERR" >&2
11441144
rm "$LAST_OUT" "$LAST_ERR"
1145+
if [ ${exit_status} != 0 ]; then
1146+
collect_k8s_logs
1147+
fi
11451148
return ${exit_status}
11461149
}
11471150

0 commit comments

Comments
 (0)