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

Unit test tries to access /var/lib/lago/subnets #741

Open
galitf opened this issue Jun 17, 2018 · 0 comments
Open

Unit test tries to access /var/lib/lago/subnets #741

galitf opened this issue Jun 17, 2018 · 0 comments

Comments

@galitf
Copy link
Contributor

galitf commented Jun 17, 2018

We should use a mock object for the subnet store, not using the real one.

===================================================================================================== ERRORS ======================================================================================================
________________________________________________________ ERROR at setup of TestPrefixNetworkInitalization.test_select_mgmt_networks_single_network[conf0] _________________________________________________________

    @pytest.fixture
    def empty_prefix():
>       return lago.prefix.Prefix(prefix='')

tests/unit/lago/conftest.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py27/lib/python2.7/site-packages/lago/prefix.py:114: in __init__
    self._subnet_store = subnet_lease.SubnetStore()
.tox/py27/lib/python2.7/site-packages/lago/subnet_lease.py:99: in __init__
    self._validate_lease_dir()
.tox/py27/lib/python2.7/site-packages/lago/subnet_lease.py:117: in _validate_lease_dir
    e
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

exc = LagoSubnetLeaseBadPermissionsException('\nFailed to get access to the store at...this\ndirectory and that it exists.\n\nOriginal Exception: Permission denied',), cause = OSError(13, 'Permission denied')

    def raise_from(exc, cause):
        """
            Equivalent to:
    
                raise EXCEPTION from CAUSE
    
            on Python 3. (See PEP 3134).
            """
        # Is either arg an exception class (e.g. IndexError) rather than
        # instance (e.g. IndexError('my message here')? If so, pass the
        # name of the class undisturbed through to "raise ... from ...".
        if isinstance(exc, type) and issubclass(exc, Exception):
            e = exc()
            # exc = exc.__name__
            # execstr = "e = " + _repr_strip(exc) + "()"
            # myglobals, mylocals = _get_caller_globals_and_locals()
            # exec(execstr, myglobals, mylocals)
        else:
            e = exc
        e.__suppress_context__ = False
        if isinstance(cause, type) and issubclass(cause, Exception):
            e.__cause__ = cause()
            e.__suppress_context__ = True
        elif cause is None:
            e.__cause__ = None
            e.__suppress_context__ = True
        elif isinstance(cause, BaseException):
            e.__cause__ = cause
            e.__suppress_context__ = True
        else:
            raise TypeError("exception causes must derive from BaseException")
        e.__context__ = sys.exc_info()[1]
>       raise e
E       LagoSubnetLeaseBadPermissionsException: 
E       Failed to get access to the store at /var/lib/lago/subnets.
E       Please make sure that you have R/W permissions to this
E       directory and that it exists.
E       
E       Original Exception: Permission denied

.tox/py27/lib/python2.7/site-packages/future/utils/__init__.py:454: LagoSubnetLeaseBadPermissionsException
________________________________________________________ ERROR at setup of TestPrefixNetworkInitalization.test_select_mgmt_networks_single_network[conf1] ___________
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

No branches or pull requests

1 participant