From a177de7e0e7f1e77cd47206441e1f4204e6f9c29 Mon Sep 17 00:00:00 2001 From: Christian Coffield Date: Tue, 7 Jan 2025 17:32:49 -0500 Subject: [PATCH] testing fixes --- mock/service/service.go | 8 +------- utils/utils_test.go | 7 +++++-- 2 files changed, 6 insertions(+), 9 deletions(-) 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)