diff --git a/tests/sanity/fake_cloud_provider.go b/tests/sanity/fake_cloud_provider.go index 4270b97a8d..c7e374f654 100644 --- a/tests/sanity/fake_cloud_provider.go +++ b/tests/sanity/fake_cloud_provider.go @@ -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()),