Example #1
0
 def testNonExistingPool1(self):
     """
     Returns an error code, just the wrong one.
     """
     (_, rc, _) = checked_call(
        Manager.GetCacheObjectPath(self._proxy, pool_name='notapool'),
        ManagerSpec.OUTPUT_SIGS[_MN.GetCacheObjectPath]
     )
     self.assertNotEqual(rc, self._errors.OK)
Example #2
0
 def testNonExistingPool(self):
     """
     Currently, the error return code is DEV_NOTFOUND, it should
     be POOL_NOTFOUND
     """
     (_, rc, _) = checked_call(
        Manager.GetCacheObjectPath(self._proxy, pool_name='notapool'),
        ManagerSpec.OUTPUT_SIGS[_MN.GetCacheObjectPath]
     )
     self.assertEqual(rc, self._errors.POOL_NOTFOUND)
Example #3
0
    def testException1(self):
        """
        An error is returned if the pool does not exist.

        Aside from the error value, the results are correct.
        """
        (_, rc, _) = checked_call(
           Manager.GetCacheObjectPath(self._proxy, pool_name='notapool'),
           ManagerSpec.OUTPUT_SIGS[_MN.GetCacheObjectPath]
        )
        self.assertNotEqual(rc, self._errors.OK)
Example #4
0
    def testException(self):
        """
        An error is returned if the pool does not exist.

        Unfortunately, it is the wrong error.
        """
        (_, rc, _) = checked_call(
           Manager.GetCacheObjectPath(self._proxy, pool_name='notapool'),
           ManagerSpec.OUTPUT_SIGS[_MN.GetCacheObjectPath]
        )
        self.assertEqual(rc, self._errors.POOL_NOTFOUND)
Example #5
0
    def testExecution(self):
        """
        There should be success if the pool does exist.

        But, for some reason, there is not.
        """
        (result, rc, _) = checked_call(
           Manager.GetCacheObjectPath(self._proxy, pool_name=self._POOLNAME),
           ManagerSpec.OUTPUT_SIGS[_MN.GetCacheObjectPath]
        )
        self.assertEqual(rc, self._errors.OK)
        self.assertNotEqual(result, "")
Example #6
0
def get_cache(top, pool):
    """
    Get cache given ``pool``.

    :param top: the top object
    :param str pool: the name of the pool

    :returns: the corresponding object
    :rtype: ProxyObject
    :raises StratisCliRuntimeError: if failure to get object
    """
    (cache_object_path, rc, message) = \
       Manager.GetCacheObjectPath(top, name=pool)

    if rc != StratisdErrorsGen.get_object().OK:
        raise StratisCliRuntimeError(rc, message)

    return get_object(cache_object_path)