intel / pmem-csi

Persistent Memory Container Storage Interface Driver
Apache License 2.0
164 stars 55 forks source link

Write unit test for LVM device manager's `creteNS()` functionality #692

Open avalluri opened 4 years ago

avalluri commented 4 years ago

As pointed in https://github.com/intel/pmem-csi/pull/688#discussion_r443503303, currently, there are no tests for validating if the LVM device manager uses only requested pmemPercentage out of available PMEM space of a region. This is a bit complicated as the testing this requires underlined PMEM region/namespace properties.

It would be good if we could find a way to develop a test case for this. As suggest by @pohly, one way is making createNS() work on an interface, so that tests could have a mock implementation.

pohly commented 4 years ago

We already had two bugs in that code (fixed by https://github.com/intel/pmem-csi/pull/714):

okartau commented 4 years ago

I just detected a third bug, fix in #717 I agree, unit test code would help significantly. One of the bugs was regression caused by omitted code lines in function move where original code was correct. We cant have really same what comes form HW, but we can use some pre-defined sets of typical value combinations.

pohly commented 3 years ago

We do have infrastructure for mocking libndctl now in https://github.com/intel/pmem-csi/tree/devel/pkg/ndctl/fake

That could be used for this.