swh_storage_backend_config = {'check_config': {'check_write': True}, 'cls': 'postgresql', 'db': "dbname=storage user=postgres host=127.0.0.1 port=16058 options=''", 'journal_writer': {'cls': 'memory'}, ...}
@pytest.fixture
def swh_storage(swh_storage_backend_config):
> return get_storage(**swh_storage_backend_config)
.tox/py3/lib/python3.7/site-packages/swh/storage/pytest_plugin.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = 'postgresql'
kwargs = {'db': "dbname=storage user=postgres host=127.0.0.1 port=16058 options=''", 'journal_writer': {'cls': 'memory'}, 'objstorage': {'cls': 'memory'}}
class_path = '.postgresql.storage.Storage', module_path = '.postgresql.storage'
class_name = 'Storage'
module = <module 'swh.storage.postgresql.storage' from '/var/lib/jenkins/workspace/DSTO/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/storage/postgresql/storage.py'>
Storage = <class 'swh.storage.postgresql.storage.Storage'>
check_config = {'check_write': True}
storage = <swh.storage.postgresql.storage.Storage object at 0x7f0d45792390>
def get_storage(cls: str, **kwargs) -> "StorageInterface":
"""Get a storage object of class `storage_class` with arguments
`storage_args`.
Args:
cls (str):
storage's class, can be:
- ``local`` to use a postgresql database
- ``cassandra`` to use a cassandra database
- ``remote`` to connect to a swh-storage server
- ``memory`` for an in-memory storage, useful for fast tests
- ``filter``, ``buffer``, ... to use specific storage "proxies", see their
respective documentations
args (dict): dictionary with keys
Returns:
an instance of swh.storage.Storage or compatible class
Raises:
ValueError if passed an unknown storage class.
"""
if "args" in kwargs:
warnings.warn(
'Explicit "args" key is deprecated, use keys directly instead.',
DeprecationWarning,
)
kwargs = kwargs["args"]
if cls == "pipeline":
return get_storage_pipeline(**kwargs)
if cls == "local":
warnings.warn(
'The "local" storage class is deprecated, use "postgresql" instead.',
DeprecationWarning,
)
class_path = STORAGE_IMPLEMENTATIONS.get(cls)
if class_path is None:
raise ValueError(
"Unknown storage class `%s`. Supported: %s"
% (cls, ", ".join(STORAGE_IMPLEMENTATIONS))
)
(module_path, class_name) = class_path.rsplit(".", 1)
module = importlib.import_module(module_path, package=__package__)
Storage = getattr(module, class_name)
check_config = kwargs.pop("check_config", {})
storage = Storage(**kwargs)
if check_config:
if not storage.check_config(**check_config):
> raise EnvironmentError("storage check config failed")
E OSError: storage check config failed
.tox/py3/lib/python3.7/site-packages/swh/storage/__init__.py:82: OSError
TEST RESULT
TEST RESULT
- Run At
- Jul 27 2021, 5:40 PM