Skip to content

Commit 76ecb3b

Browse files
authored
K8SPSMDB-886 - Add cluster wide run for PR tests and fix some tests (#1345)
* K8SPSMDB-886 - Add cluster wide run for PR tests and fix some tests * Fix smart-update test * Fix pitr-physical test
1 parent 5f273f1 commit 76ecb3b

File tree

12 files changed

+26
-60
lines changed

12 files changed

+26
-60
lines changed

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ pipeline {
244244
environment {
245245
CLOUDSDK_CORE_DISABLE_PROMPTS = 1
246246
CLEAN_NAMESPACE = 1
247+
OPERATOR_NS = 'psmdb-operator'
247248
GIT_SHORT_COMMIT = sh(script: 'git rev-parse --short HEAD', , returnStdout: true).trim()
248249
VERSION = "${env.GIT_BRANCH}-${env.GIT_SHORT_COMMIT}"
249250
CLUSTER_NAME = sh(script: "echo jen-psmdb-${env.CHANGE_ID}-${GIT_SHORT_COMMIT}-${env.BUILD_NUMBER} | tr '[:upper:]' '[:lower:]'", , returnStdout: true).trim()

e2e-tests/custom-replset-name/conf/backup-aws-s3.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

e2e-tests/custom-replset-name/conf/backup-gcp-cs.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

e2e-tests/custom-replset-name/run

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ set -o xtrace
66
test_dir=$(realpath $(dirname $0))
77
. ${test_dir}/../functions
88

9-
create_namespace $namespace
10-
deploy_operator
9+
create_infra $namespace
1110
apply_s3_storage_secrets
1211
deploy_minio
1312

@@ -42,32 +41,12 @@ wait_backup_agent $cluster-shard5-2
4241
wait_backup_agent $cluster-shard7-0
4342
wait_backup_agent $cluster-shard7-1
4443
wait_backup_agent $cluster-shard7-2
45-
backup_name_aws="backup-aws-s3"
4644
backup_name_minio="backup-minio"
47-
backup_name_gcp="backup-gcp-cs"
4845

4946
desc 'run backups'
5047
run_backup minio
5148
wait_backup "$backup_name_minio"
5249

53-
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
54-
run_backup aws-s3
55-
run_backup gcp-cs
56-
57-
wait_backup "$backup_name_aws"
58-
wait_backup "$backup_name_gcp"
59-
fi
60-
61-
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
62-
desc 'check backup and restore -- aws-s3'
63-
run_restore $backup_name_aws 3 1 "-mongos"
64-
wait_restore $backup_name_aws $cluster "ready"
65-
66-
desc 'check backup and restore -- gcp-cs'
67-
run_restore $backup_name_gcp 3 1 "-mongos"
68-
wait_restore $backup_name_gcp $cluster "ready"
69-
fi
70-
7150
desc 'check backup and restore -- minio'
7251
run_restore $backup_name_minio 3 1 "-mongos"
7352

e2e-tests/expose-sharded/run

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function main() {
112112
wait_for_running $cluster-rs0 3
113113
wait_for_running $cluster-cfg 3 "false"
114114
wait_for_running $cluster-mongos 3
115-
wait_cluster_consistency "${cluster}" 3
115+
wait_cluster_consistency "${cluster}"
116116

117117
desc 'check if service and statefulset created with expected config'
118118
compare_kubectl statefulset/$cluster-rs0
@@ -141,7 +141,7 @@ function main() {
141141
wait_for_running $cluster-rs0 3
142142
wait_for_running $cluster-cfg 3 "false"
143143
wait_for_running $cluster-mongos 3
144-
wait_cluster_consistency "${cluster}" 3
144+
wait_cluster_consistency "${cluster}"
145145

146146
run_mongos \
147147
'use myApp\n db.test.insert({ x: 100501 })' \
@@ -159,7 +159,7 @@ function main() {
159159
wait_for_running $cluster-rs0 3
160160
wait_for_running $cluster-cfg 3 "false"
161161
wait_for_running $cluster-mongos 3
162-
wait_cluster_consistency "${cluster}" 3
162+
wait_cluster_consistency "${cluster}"
163163

164164
run_mongos \
165165
'use myApp\n db.test.insert({ x: 100502 })' \
@@ -190,7 +190,7 @@ function main() {
190190
wait_for_running $cluster-rs0 3
191191
wait_for_running $cluster-cfg 3 "false"
192192
wait_for_running $cluster-mongos 3
193-
wait_cluster_consistency "${cluster}" 3
193+
wait_cluster_consistency "${cluster}"
194194

195195
run_mongos \
196196
'use myApp\n db.test.insert({ x: 100504 })' \
@@ -207,7 +207,7 @@ function main() {
207207
wait_for_running $cluster-rs0 3
208208
wait_for_running $cluster-cfg 3 "false"
209209
wait_for_running $cluster-mongos 3
210-
wait_cluster_consistency "${cluster}" 3
210+
wait_cluster_consistency "${cluster}"
211211

212212
run_mongos \
213213
'use myApp\n db.test.insert({ x: 100505 })' \

e2e-tests/multi-cluster-service/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ desc 'check if all 3 Pods started'
9898
wait_for_running $cluster-rs0 3
9999
wait_for_running $cluster-cfg 3 "false"
100100
wait_for_running $cluster-mongos 3
101-
wait_cluster_consistency "${cluster}" 3
101+
wait_cluster_consistency "${cluster}"
102102

103103
desc "enable MCS"
104104
kubectl_bin patch psmdb ${cluster} --type json -p='[{"op":"add","path":"/spec/multiCluster/enabled","value":true}]'
105105

106106
desc "check if ServiceExport objects are created"
107107
wait_service_export
108108
wait_service_import
109-
wait_cluster_consistency "${cluster}" 3
109+
wait_cluster_consistency "${cluster}"
110110

111111
desc "delete cluster membership"
112112
gcloud container fleet memberships delete $k8s_cluster_name --quiet

e2e-tests/operator-self-healing-chaos/run

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ setup_cluster() {
1818

1919
# check if all 3 Pods started
2020
wait_for_running "$cluster" 3
21-
wait_cluster_consistency "${cluster/-rs0/}" 3
21+
wait_cluster_consistency "${cluster/-rs0/}"
2222
}
2323

2424
fail_pod() {
@@ -61,7 +61,7 @@ fail_pod() {
6161
# check scale down
6262
wait_for_delete pod/$cluster-3
6363
wait_for_running "$cluster" 3
64-
wait_cluster_consistency "${cluster/-rs0/}" 3
64+
wait_cluster_consistency "${cluster/-rs0/}"
6565
}
6666

6767
kill_pod() {
@@ -87,7 +87,7 @@ kill_pod() {
8787

8888
# check scale up
8989
wait_for_running "$cluster" 5
90-
wait_cluster_consistency "${cluster/-rs0/}" 5
90+
wait_cluster_consistency "${cluster/-rs0/}"
9191
}
9292

9393
network_loss() {
@@ -108,7 +108,7 @@ network_loss() {
108108

109109
# check scale up
110110
wait_for_running "$cluster" 5
111-
wait_cluster_consistency "${cluster/-rs0/}" 5
111+
wait_cluster_consistency "${cluster/-rs0/}"
112112
}
113113

114114
main() {

e2e-tests/pitr-physical/run

Lines changed: 1 addition & 1 deletion
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"
72+
wait_restore "$backup_name" "$cluster_name" "ready" "1" "1000"
7373
echo
7474
set -o xtrace
7575

e2e-tests/rs-shard-migration/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function main() {
3535
sleep 10
3636
wait_for_running "${cluster}-rs0" "${CLUSTER_SIZE}" "false"
3737
wait_for_running "${cluster}-cfg" "${CLUSTER_SIZE}" "false"
38-
wait_cluster_consistency "${cluster}" "${CLUSTER_SIZE}"
38+
wait_cluster_consistency "${cluster}"
3939

4040
if [[ $(kubectl_bin get statefulset/${cluster}-mongos -o jsonpath='{.status.readyReplicas}') -lt 1 ]]; then
4141
echo "Mongos hasn't been properly started. Exiting..."
@@ -62,7 +62,7 @@ function main() {
6262
kubectl_bin patch psmdb/${cluster} --type json -p='[{"op":"remove","path":"/spec/sharding"}]'
6363
sleep 20
6464
wait_for_running "${cluster}-rs0" "${CLUSTER_SIZE}" "true"
65-
wait_cluster_consistency "${cluster}" "${CLUSTER_SIZE}"
65+
wait_cluster_consistency "${cluster}"
6666
simple_data_check "${cluster}-rs0" "${CLUSTER_SIZE}"
6767

6868
if [[ -n "$(get_shard_parameter ${cluster} ${namespace} lastCommitedOpTime)" ]] \

e2e-tests/smart-update/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function check_pod_update() {
1717
sleep 1
1818
echo -n .
1919
let retry+=1
20-
img=$(kubectl get pod/${pod_name} -o jsonpath='{.spec.containers[0].image}')
20+
img=$(kubectl get pod/${pod_name} -o jsonpath='{.spec.containers[0].image}' || echo "ERROR_GETTING_POD")
2121
if [ "${img}" == "${IMAGE_MONGOD_TO_UPDATE}" ]; then
2222
echo "OK: Image ${img} was updated for pod ${pod_name}!"
2323
break

0 commit comments

Comments
 (0)