Skip to content

Commit

Permalink
testing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianAtDell committed Jan 7, 2025
1 parent 86a7b55 commit a177de7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 1 addition & 7 deletions mock/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 5 additions & 2 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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{}

Expand All @@ -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)
Expand Down

0 comments on commit a177de7

Please sign in to comment.