Skip to content

Commit

Permalink
race condition removed
Browse files Browse the repository at this point in the history
  • Loading branch information
OBoehrer authored and jpalermo committed Oct 31, 2024
1 parent 2beb6a6 commit 351ff0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/openstack_cpi_golang/cpi/volume/volume_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ var _ = Describe("VolumeService", func() {
It("times out while waiting for volume to become some_target_status", func() {
volumeFacade.GetVolumeReturns(&volumes.Volume{ID: "123-456", Status: "creating"}, nil)

err := volumeService.WaitForVolumeToBecomeStatus("123-456", 1, "some_target_status")
err := volumeService.WaitForVolumeToBecomeStatus("123-456", 0, "some_target_status")

Expect(err.Error()).To(Equal("timeout while waiting for volume to become some_target_status"))
})

It("returns an error if it cannot get the volume", func() {
volumeFacade.GetVolumeReturns(&volumes.Volume{}, errors.New("boom"))

err := volumeService.WaitForVolumeToBecomeStatus("123-456", 1, "some_target_status")
err := volumeService.WaitForVolumeToBecomeStatus("123-456", 1*time.Minute, "some_target_status")

Expect(volumeFacade.GetVolumeCallCount()).To(Equal(1))
Expect(err.Error()).To(Equal("failed to retrieve volume information: boom"))
Expand Down Expand Up @@ -192,15 +192,15 @@ var _ = Describe("VolumeService", func() {
It("times out while waiting for snapshot to become some_target_status", func() {
volumeFacade.GetSnapshotReturns(&snapshots.Snapshot{ID: "123-456", Status: "creating"}, nil)

err := volumeService.WaitForSnapshotToBecomeStatus("123-456", 1, "some_target_status")
err := volumeService.WaitForSnapshotToBecomeStatus("123-456", 0, "some_target_status")

Expect(err.Error()).To(Equal("timeout while waiting for snapshot to become some_target_status"))
})

It("returns an error if it cannot get the snapshot", func() {
volumeFacade.GetSnapshotReturns(&snapshots.Snapshot{}, errors.New("boom"))

err := volumeService.WaitForSnapshotToBecomeStatus("123-456", 1, "some_target_status")
err := volumeService.WaitForSnapshotToBecomeStatus("123-456", 1*time.Minute, "some_target_status")

Expect(volumeFacade.GetSnapshotCallCount()).To(Equal(1))
Expect(err.Error()).To(Equal("failed to retrieve snapshot information: boom"))
Expand Down

0 comments on commit 351ff0a

Please sign in to comment.