diff --git a/mock/service/service.go b/mock/service/service.go index 3e8eeeb..8e05917 100644 --- a/mock/service/service.go +++ b/mock/service/service.go @@ -59,16 +59,10 @@ func NewServer() MockServer { s.newVolume("Mock Volume 1", gib100), s.newVolume("Mock Volume 2", gib100), s.newVolume("Mock Volume 3", gib100), - s.newVolume("Mock Volume 4", gib100), } // add some mock snapshots to start with, too - s.snaps = []csi.Snapshot{ - s.newSnapshot("Mock Snapshot 1", gib100), - s.newSnapshot("Mock Snapshot 2", gib100), - s.newSnapshot("Mock Snapshot 3", gib100), - s.newSnapshot("Mock Snapshot 4", gib100), - } + s.snaps = []csi.Snapshot{} return s } diff --git a/utils/utils_test.go b/utils/utils_test.go index cee9988..5a139fc 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -569,7 +569,7 @@ func TestPageVolumes(t *testing.T) { case v, ok := <-cvol: if !ok { Expect(err).To(BeNil()) - Expect(vols).To(HaveLen(4)) + Expect(vols).To(HaveLen(3)) // the mock service is initialized to have 3 volumes return } vols = append(vols, v) @@ -591,6 +591,9 @@ func TestPageSnapshots(t *testing.T) { // Create a context ctx := context.Background() + // The mock service is initialized to have zero snapshots, so, create one + svc.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{SourceVolumeId: "1", Name: "snapshot0"}) + // Create a list volumes request req := csi.ListSnapshotsRequest{} @@ -603,7 +606,7 @@ func TestPageSnapshots(t *testing.T) { case v, ok := <-csnap: if !ok { Expect(err).To(BeNil()) - Expect(snaps).To(HaveLen(4)) + Expect(snaps).To(HaveLen(1)) return } snaps = append(snaps, v)