Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LVM unit tests. #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

BobBall
Copy link
Contributor

@BobBall BobBall commented Apr 8, 2016

The UT depend on a specific path for lvcreate binaries, however
the path actually used is distro dependent. On Debian distros,
lvcreate is in /sbin. SM correctly auto detects the location,
but the UT were expecting it in /usr/sbin.

Fix the UT so they use the detected path for the executables.

The UT depend on a specific path for lvcreate binaries, however
the path actually used is distro dependent.  On Debian distros,
lvcreate is in /sbin.  SM correctly auto detects the location,
but the UT were expecting it in /usr/sbin.

Fix the UT so they use the detected path for the executables.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 28.746% when pulling bffb97f on BobBall:lvm-UT-fix into dd3e818 on xapi-project:master.

@germanop
Copy link
Contributor

@MarkSymsCtx this seems reasonable to me but I'd rather have you looking at it

Copy link
Contributor

@MarkSymsCtx MarkSymsCtx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need a quick fix then this change is OK.

However, as the unit tests are apparently distro dependent this means that they are not correctly isolated from the execution environment and are accessing the local filesystem which should not be the case. So we can either approve this as a short term fix and raise a new issue to correctly isolate the tests, which may be non-trivial depending on how twisted the logic is, or we reject and only do the test rework to isolate.

@BobBall
Copy link
Contributor Author

BobBall commented Dec 26, 2016

The real issue is that https://github.com/xapi-project/sm/blob/master/drivers/lvutil.py#L40 attempts to detect the location of lv executables on file import.
This means the UT have no real opportunity to provide a stable environment.
Using the detected path seems to be the least-worse change as it doesn't change the functionality.

After approving this change a refactor to fix the lvutil code would at least have UT validating the refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants