Open avalluri opened 4 years ago
We already had two bugs in that code (fixed by https://github.com/intel/pmem-csi/pull/714):
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.
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.
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.