Skip to content

Commit

Permalink
Wait for both commands to finish before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Dec 19, 2018
1 parent c76a067 commit eb32d60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/controller/mysqlcluster/mysqlcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ var _ = Describe("MysqlCluster controller", func() {
Expect(pod1).To(haveLabelWithValue("role", "replica"))
Expect(pod1).To(haveLabelWithValue("healthy", "yes"))
})
It("should label pods as master eaven if pods does not exists", func() {
It("should label pods as master even if other pods does not exists", func() {
pod0 := getPod(cluster, 0)
Expect(c.Create(context.TODO(), pod0)).To(Succeed())
pod1 := getPod(cluster, 1)
Expand All @@ -300,6 +300,7 @@ var _ = Describe("MysqlCluster controller", func() {

// assert pods labels
// master
// TODO: this may be a flaky test so use Eventually
Expect(c.Get(context.TODO(), objToKey(pod0), pod0)).To(Succeed())
Expect(pod0).To(haveLabelWithValue("role", "master"))
Expect(pod0).To(haveLabelWithValue("healthy", "yes"))
Expand Down
7 changes: 5 additions & 2 deletions pkg/sidecar/apptakebackup/apptakebackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ func pushBackupFromTo(srcHost, destBucket string) error {
errChan <- rclone.Run()
}()

if err := <-errChan; err != nil {
return err
// wait for both commands to finish successful
for i := 1; i <= 2; i++ {
if err := <-errChan; err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit eb32d60

Please sign in to comment.