Skip to content

Commit

Permalink
Fix fake cloud to support snapshot not found case
Browse files Browse the repository at this point in the history
  • Loading branch information
bertinatto committed May 13, 2019
1 parent d7e003a commit d6030c0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/sanity/fake_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func (c *fakeCloudProvider) GetMetadata() cloud.MetadataService {

func (c *fakeCloudProvider) CreateDisk(ctx context.Context, volumeName string, diskOptions *cloud.DiskOptions) (*cloud.Disk, error) {
r1 := rand.New(rand.NewSource(time.Now().UnixNano()))
if len(diskOptions.SnapshotID) > 0 {
if _, ok := c.snapshots[diskOptions.SnapshotID]; !ok {
return nil, cloud.ErrNotFound
}
}
d := &fakeDisk{
Disk: &cloud.Disk{
VolumeID: fmt.Sprintf("vol-%d", r1.Uint64()),
Expand Down

0 comments on commit d6030c0

Please sign in to comment.