Skip to content

Commit 915ffc8

Browse files
committed
remove wait and fix tests
1 parent 788505c commit 915ffc8

File tree

5 files changed

+4
-34
lines changed
  • e2e-tests
    • demand-backup-incremental-sharded
    • demand-backup-incremental
    • demand-backup-physical-sharded
    • demand-backup-physical
  • pkg/controller/perconaservermongodbrestore

5 files changed

+4
-34
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ run_recovery_check() {
5050
# we don't wait for cluster readiness here because the annotation gets removed then
5151
wait_restore "${backup_name}" "${cluster}" "ready" "0" "3000"
5252

53-
sleep 15
54-
55-
if [ $(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"') == null ]; then
53+
if [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"')" == null ] && [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-in-progress"')" == null ]; then
5654
log "psmdb/${cluster} should be annotated with percona.com/resync-pbm after a incremental restore"
5755
exit 1
5856
fi

e2e-tests/demand-backup-incremental/run

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ run_recovery_check() {
5050
# we don't wait for cluster readiness here because the annotation gets removed then
5151
wait_restore "${backup_name}" "${cluster}" "ready" "0" "1800"
5252

53-
sleep 15
54-
55-
if [ $(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"') == null ]; then
53+
if [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"')" == null ] && [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-in-progress"')" == null ]; then
5654
log "psmdb/${cluster} should be annotated with percona.com/resync-pbm after a incremental restore"
5755
exit 1
5856
fi

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ run_recovery_check() {
3737
# we don't wait for cluster readiness here because the annotation gets removed then
3838
wait_restore "${backup_name}" "${cluster}" "ready" "0" "3000"
3939

40-
sleep 15
41-
42-
if [ $(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"') == null ]; then
40+
if [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"')" == null ] && [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-in-progress"')" == null ]; then
4341
echo "psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
4442
exit 1
4543
fi

e2e-tests/demand-backup-physical/run

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ run_recovery_check() {
3737
# we don't wait for cluster readiness here because the annotation gets removed then
3838
wait_restore "${backup_name}" "${cluster}" "ready" "0" "1800"
3939

40-
sleep 15
41-
42-
if [ $(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"') == null ]; then
40+
if [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-pbm"')" == null ] && [ "$(kubectl_bin get psmdb ${cluster} -o yaml | yq '.metadata.annotations."percona.com/resync-in-progress"')" == null ]; then
4341
echo "psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
4442
exit 1
4543
fi

pkg/controller/perconaservermongodbrestore/physical.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -420,28 +420,6 @@ func (r *ReconcilePerconaServerMongoDBRestore) finishPhysicalRestore(ctx context
420420
return false, errors.Wrapf(err, "annotate psmdb/%s for PBM resync", cluster.Name)
421421
}
422422

423-
err = retry.OnError(retry.DefaultBackoff, func(err error) bool {
424-
return err != nil
425-
}, func() error {
426-
c := new(psmdbv1.PerconaServerMongoDB)
427-
if err := r.client.Get(ctx, client.ObjectKeyFromObject(cluster), c); err != nil {
428-
return err
429-
}
430-
431-
if c.Annotations == nil {
432-
return errors.New("annotation wasn't added")
433-
}
434-
435-
if v, ok := c.Annotations[psmdbv1.AnnotationResyncPBM]; !ok || v != "true" {
436-
return errors.New("annotation wasn't added 2")
437-
}
438-
439-
return nil
440-
})
441-
if err != nil {
442-
return false, errors.Wrap(err, "failed to check if annotation was added")
443-
}
444-
445423
if err := r.updateMongodSts(ctx, cluster, func(sts *appsv1.StatefulSet) error {
446424
if sts.Annotations[psmdbv1.AnnotationRestoreInProgress] == "true" {
447425
delete(sts.Annotations, psmdbv1.AnnotationRestoreInProgress)

0 commit comments

Comments
 (0)