[RFC]Add unit test for RAID
Needs ReviewPublic

Authored by shubham on May 22 2019, 1:56 PM.

Details

Diff Detail

Repository
R16 KPMCore
Branch
raid
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12159
Build 12177: arc lint + arc unit
shubham requested review of this revision.May 22 2019, 1:56 PM
shubham created this revision.
shubham updated this revision to Diff 58473.EditedMay 22 2019, 2:13 PM

I am new with unit tests, comments are appreciated.

shubham updated this revision to Diff 58474.May 22 2019, 2:17 PM

Remove extra line

shubham updated this revision to Diff 58541.May 23 2019, 11:12 AM

Add condition in whihc partition size can not be computed

stikonas accepted this revision.May 23 2019, 11:16 PM
stikonas added inline comments.
test/testraid.cpp
89

Why do we need to mention -1 here? Surely if something is <= 0, then -1 will also satisfy the same condition.

This revision is now accepted and ready to land.May 23 2019, 11:16 PM
stikonas requested changes to this revision.May 23 2019, 11:16 PM
This revision now requires changes to proceed.May 23 2019, 11:16 PM

@stikonas Does the rest looks sensible?

shubham added inline comments.May 24 2019, 2:53 AM
test/testraid.cpp
89

-1 means the situation when partition's size can not be computed.

cjlcarvalho requested changes to this revision.May 24 2019, 2:52 PM
cjlcarvalho added inline comments.
test/testraid.cpp
73

Maybe there is a better way for testing RAID than checking if /home partition is inside of a RAID volume.

75

This device need to be created before that... And please don't use simple "md" for RAID device names.

There are some procedures missing in this test. First, you need to look if mdadm is installed in the system before testing RAID. Then, you need to test the creation of a RAID device and check if it was successfully created. After that, you can try to create partitions on it and test if it exists.

There are some procedures missing in this test. First, you need to look if mdadm is installed in the system before testing RAID. Then, you need to test the creation of a RAID device and check if it was successfully created. After that, you can try to create partitions on it and test if it exists.

And we definitely don't want to use real devices for testing creation. It might make sense to set up temporary loop device as a test disk where we can try to create and then remove RAID.

shubham updated this revision to Diff 58650.EditedMay 25 2019, 2:39 PM

Add check for mdadm tool
I am still working on this revision.
How can the creation of RAID be tested and what do you mean by loop device?

shubham updated this revision to Diff 58651.May 25 2019, 2:59 PM

Add test for RAID craetion

stikonas added inline comments.May 25 2019, 3:20 PM
test/testraid.cpp
88

In principle I think we should test kpmcore's functionality of raid creation, not mdadm's.

Just running mdadm --create will simply print mdadm: an md device must be given in this mode