Skip to content

ListSnapshot: tests are not precise #335

Open
@pohly

Description

@pohly

All of the "should return empty when" tests have a conceptual problem: the don't ensure that there are snapshots to return.
In other words, a broken driver that doesn't check the snapshot or source volume ID and always returns all current snapshots passes the test because the empty list is the expected outcome.

Example:

It("should return empty when the specified source volume id does not exist", func() {
snapshots, err := r.ListSnapshots(
context.Background(),
&csi.ListSnapshotsRequest{SourceVolumeId: sc.Config.IDGen.GenerateUniqueValidVolumeID()})
Expect(err).NotTo(HaveOccurred())
Expect(snapshots).NotTo(BeNil())
Expect(snapshots.GetEntries()).To(BeEmpty())
})

What these tests should do is to first create at least one snapshot, then ensure that the result is empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions