Skip to content

Commit 29aabe5

Browse files
authored
K8SPSMDB-886 - Fix tests for release (#1347)
1 parent 76ecb3b commit 29aabe5

File tree

10 files changed

+20
-20
lines changed
  • e2e-tests

10 files changed

+20
-20
lines changed

e2e-tests/balancer/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ check_balancer() {
1212

1313
local balancer_running
1414
balancer_running=$(run_mongos 'db.adminCommand({balancerStatus: 1}).mode' "clusterAdmin:clusterAdmin123456@$cluster-mongos.$namespace" \
15-
| grep -E -v "Percona Server for MongoDB|connecting to:|Implicit session:|versions do not match|bye")
15+
| grep -E -v "Percona Server for MongoDB|connecting to:|Implicit session:|versions do not match|Error saving history file:|bye")
1616

1717
if [[ $balancer_running != "$expected" ]]; then
1818
echo "Unexpected output from \"db.adminCommand({balancerStatus: 1}).mode\": $balancer_running"

e2e-tests/demand-backup-physical-sharded/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ run_recovery_check() {
2929
local backup_name=$1
3030
local compare_suffix=${2:-"_restore"}
3131

32-
wait_restore "${backup_name}" "${cluster}" "requested" "0" "420"
32+
wait_restore "${backup_name}" "${cluster}" "requested" "0" "600"
3333
echo
3434

3535
compare_kubectl "statefulset/${cluster}-rs0" ${compare_suffix}

e2e-tests/expose-sharded/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ function compare_mongo_config() {
4646
desc "Compare mongo config"
4747

4848
cfg_0_endpoint="$cluster-cfg-0.$cluster-cfg.$namespace.svc.cluster.local"
49-
cfg_0_endpoint_actual=$(run_mongo 'var host;var x=0;rs.conf().members.forEach(function(d){ if(d.tags.podName=="some-name-cfg-0"){ host=rs.conf().members[x].host;print(host)};x=x+1; })' "clusterAdmin:clusterAdmin123456@${cluster}-cfg.${namespace}" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye')
49+
cfg_0_endpoint_actual=$(run_mongo 'var host;var x=0;rs.conf().members.forEach(function(d){ if(d.tags.podName=="some-name-cfg-0"){ host=rs.conf().members[x].host;print(host)};x=x+1; })' "clusterAdmin:clusterAdmin123456@${cluster}-cfg.${namespace}" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye')
5050

5151
rs0_0_endpoint="$cluster-rs0-0.$cluster-rs0.$namespace.svc.cluster.local"
52-
rs0_0_endpoint_actual=$(run_mongo 'var host;var x=0;rs.conf().members.forEach(function(d){ if(d.tags.podName=="some-name-rs0-0"){ host=rs.conf().members[x].host;print(host)};x=x+1; })' "clusterAdmin:clusterAdmin123456@${cluster}-rs0.${namespace}" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye')
52+
rs0_0_endpoint_actual=$(run_mongo 'var host;var x=0;rs.conf().members.forEach(function(d){ if(d.tags.podName=="some-name-rs0-0"){ host=rs.conf().members[x].host;print(host)};x=x+1; })' "clusterAdmin:clusterAdmin123456@${cluster}-rs0.${namespace}" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye')
5353

5454
if [[ $rs0_0_endpoint_actual != "$rs0_0_endpoint:27017" || $cfg_0_endpoint_actual != "$cfg_0_endpoint:27017" ]]; then
5555
desc "Actual values rs $rs0_0_endpoint_actual and cfg $cfg_0_endpoint_actual do not match expected rs $rs0_0_endpoint:27017 and cfg $cfg_0_endpoint:27017"

e2e-tests/functions

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ compare_mongo_cmd() {
765765
local collection="${6:-test}"
766766

767767
run_mongo "use ${database}\n db.${collection}.${command}()" "$uri" "mongodb" "$suffix" \
768-
| egrep -v 'I NETWORK|W NETWORK|F NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match' \
768+
| egrep -v 'I NETWORK|W NETWORK|F NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' \
769769
| $sed -re 's/ObjectId\("[0-9a-f]+"\)//; s/-[0-9]+.svc/-xxx.svc/' \
770770
>$tmp_dir/${command}${postfix}
771771
diff ${test_dir}/compare/${command}${postfix}.json $tmp_dir/${command}${postfix}
@@ -780,7 +780,7 @@ compare_mongos_cmd() {
780780
local collection="${6:-test}"
781781

782782
run_mongos "use ${database}\n db.${collection}.${command}()" "$uri" "mongodb" "$suffix" \
783-
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match' \
783+
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' \
784784
| $sed -re 's/ObjectId\("[0-9a-f]+"\)//; s/-[0-9]+.svc/-xxx.svc/' \
785785
>$tmp_dir/${command}${postfix}
786786
diff ${test_dir}/compare/${command}${postfix}.json $tmp_dir/${command}${postfix}
@@ -1121,7 +1121,7 @@ getSecretData() {
11211121
check_mongo_auth() {
11221122
local uri="$1"
11231123

1124-
ping=$(run_mongo "db.runCommand({ ping: 1 }).ok" "$uri" "mongodb" "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match')
1124+
ping=$(run_mongo "db.runCommand({ ping: 1 }).ok" "$uri" "mongodb" "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:')
11251125
desc "ping return"
11261126
if [ "${ping}" != "1" ]; then
11271127
return 1

e2e-tests/one-pod/run

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ main() {
4545
run_mongo \
4646
'db.serverCmdLineOpts()' \
4747
"clusterAdmin:clusterAdmin123456@$cluster.$namespace" \
48-
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye' \
48+
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye' \
4949
| $sed -re 's/((Timestamp|BinData|NumberLong)\((.+?\)))/{}/g' \
5050
| jq '.parsed.systemLog' \
5151
>$tmp_dir/parsed_systemLog.json
@@ -61,7 +61,7 @@ main() {
6161
run_mongo \
6262
'db.serverCmdLineOpts()' \
6363
"clusterAdmin:clusterAdmin123456@$cluster.$namespace" \
64-
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye' \
64+
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye' \
6565
| $sed -re 's/((Timestamp|BinData|NumberLong)\((.+?\)))/{}/g' \
6666
| jq '.parsed.systemLog' \
6767
>$tmp_dir/parsed_systemLog_secret.json
@@ -74,7 +74,7 @@ main() {
7474
run_mongo \
7575
'db.serverCmdLineOpts()' \
7676
"clusterAdmin:clusterAdmin123456@$cluster.$namespace" \
77-
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye' \
77+
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye' \
7878
| $sed -re 's/((Timestamp|BinData|NumberLong)\((.+?\)))/{}/g' \
7979
| jq '.parsed.systemLog' \
8080
>$tmp_dir/parsed_systemLog_secret-2.json

e2e-tests/pitr-physical/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ check_recovery() {
6969
| if [ -z "$restore_date" ]; then $sed -e "/date:/d"; else $sed -e "s/date:/date: $restore_date/"; fi \
7070
| kubectl_bin apply -f -
7171

72-
wait_restore "$backup_name" "$cluster_name" "ready" "1" "1000"
72+
wait_restore "$backup_name" "$cluster_name" "ready" "0" "1200"
7373
echo
7474
set -o xtrace
7575

@@ -119,7 +119,7 @@ main() {
119119
write_document "-2nd"
120120
sleep 2
121121

122-
time_now=$(run_mongos 'new Date().toISOString()' "myApp:myPass@$cluster-mongos.$namespace" "mongodb" "" "--quiet" | grep -E -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match' | cut -c1-19 | tr T " ")
122+
time_now=$(run_mongos 'new Date().toISOString()' "myApp:myPass@$cluster-mongos.$namespace" "mongodb" "" "--quiet" | grep -E -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' | cut -c1-19 | tr T " ")
123123

124124
check_recovery $backup_name_minio-1 date "$time_now" "-2nd" "$cluster"
125125

e2e-tests/pitr-sharded/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ main() {
127127
write_document "-2nd"
128128
sleep 2
129129

130-
time_now=$(run_mongos 'new Date().toISOString()' "myApp:myPass@$cluster-mongos.$namespace" "mongodb" "" "--quiet" | grep -E -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match' | cut -c1-19 | tr T " ")
130+
time_now=$(run_mongos 'new Date().toISOString()' "myApp:myPass@$cluster-mongos.$namespace" "mongodb" "" "--quiet" | grep -E -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' | cut -c1-19 | tr T " ")
131131

132132
check_recovery $backup_name_minio-0 date "$time_now" "-2nd" "$cluster"
133133

e2e-tests/rs-shard-migration/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function get_shard_parameter() {
1111
local namespace=$2
1212
local parameter=${3:-lastCommittedOpTime}
1313
run_mongo 'db.isMaster().'${parameter}'' "clusterAdmin:clusterAdmin123456@${cluster_name}-rs0-0.${cluster_name}-rs0.${namespace}" "mongodb" "" "--quiet" \
14-
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match'
14+
| egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:'
1515
}
1616

1717
function main() {

e2e-tests/serviceless-external-nodes/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cat $tmp_dir/psmdb.yaml \
4646

4747
wait_cluster_consistency ${cluster}
4848

49-
run_mongo 'rs.status().members.forEach(function(z){printjson(z.name);printjson(z.stateStr); })' "clusterAdmin:clusterAdmin123456@${cluster}-rs0-0.${cluster}-rs0.${namespace}" "mongodb" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye' >"$tmp_dir/rs.txt"
49+
run_mongo 'rs.status().members.forEach(function(z){printjson(z.name);printjson(z.stateStr); })' "clusterAdmin:clusterAdmin123456@${cluster}-rs0-0.${cluster}-rs0.${namespace}" "mongodb" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:|bye' >"$tmp_dir/rs.txt"
5050

5151
cat "${test_dir}/compare/rs.txt" \
5252
| $sed -e "s/mydb-rs0-0.mydb-rs0.main.svc.cluster.local:27017/mydb-rs0-0.mydb-rs0.$namespace.svc.cluster.local:27017/" \

e2e-tests/split-horizon/run

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ set -o xtrace
4545

4646
run_mongo "rs.conf().members.map(function(member) { return member.horizons }).sort((a, b) => a.external.localeCompare(b.external))" \
4747
"clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" \
48-
mongodb "" "--quiet" >${tmp_dir}/horizons-3.json
48+
mongodb "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' >${tmp_dir}/horizons-3.json
4949
diff $test_dir/compare/horizons-3.json $tmp_dir/horizons-3.json
5050

51-
isMaster=$(run_mongo_tls "db.isMaster().ismaster" "clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" mongodb "" "--quiet" | grep -v certificateNames)
51+
isMaster=$(run_mongo_tls "db.isMaster().ismaster" "clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" mongodb "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' | grep -v certificateNames)
5252
if [ "${isMaster}" != "true" ]; then
5353
echo "mongo client should've redirect the connection to primary"
5454
exit 1
@@ -61,7 +61,7 @@ run_mongo_tls "rs.stepDown()" \
6161

6262
sleep 10 # give some time for re-election
6363

64-
isMaster=$(run_mongo_tls "db.isMaster().ismaster" "clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" mongodb "" "--quiet" | grep -v certificateNames)
64+
isMaster=$(run_mongo_tls "db.isMaster().ismaster" "clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" mongodb "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' | grep -v certificateNames)
6565
if [ "${isMaster}" != "true" ]; then
6666
echo "mongo client should've redirect the connection to primary"
6767
exit 1
@@ -80,7 +80,7 @@ wait_cluster_consistency ${cluster}
8080

8181
run_mongo "rs.conf().members.map(function(member) { return member.horizons }).sort((a, b) => a.external.localeCompare(b.external))" \
8282
"clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" \
83-
mongodb "" "--quiet" >${tmp_dir}/horizons-5.json
83+
mongodb "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' >${tmp_dir}/horizons-5.json
8484
diff $test_dir/compare/horizons-5.json $tmp_dir/horizons-5.json
8585

8686
kubectl_bin patch psmdb ${cluster} \
@@ -91,7 +91,7 @@ wait_cluster_consistency ${cluster}
9191

9292
run_mongo "rs.conf().members.map(function(member) { return member.horizons }).sort((a, b) => a.external.localeCompare(b.external))" \
9393
"clusterAdmin:[email protected],some-name-rs0-1.clouddemo.xyz,some-name-rs0-2.clouddemo.xyz" \
94-
mongodb "" "--quiet" >${tmp_dir}/horizons.json
94+
mongodb "" "--quiet" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|Error saving history file:' >${tmp_dir}/horizons.json
9595
diff $test_dir/compare/horizons-3.json $tmp_dir/horizons-3.json
9696

9797
apply_cluster ${test_dir}/conf/${cluster}.yml

0 commit comments

Comments
 (0)