userver: samples/scylla_service/testsuite/conftest.py
Loading...
Searching...
No Matches
samples/scylla_service/testsuite/conftest.py
1# /// [scylla setup]
2import os
3
4import pytest
5
6from pytest_userver.plugins.scylla import ConnectionInfo
7
8pytest_plugins = ['pytest_userver.plugins.scylla']
9# /// [scylla setup]
10
11
12@pytest.fixture(scope='session')
13def scylla_connection_info(pytestconfig) -> ConnectionInfo:
14 host = (
15 pytestconfig.option.scylla_host
16 or os.environ.get('TESTSUITE_SCYLLA_HOST')
17 or 'scylla'
18 )
19 port = (
20 pytestconfig.option.scylla_port
21 or int(os.environ.get('TESTSUITE_SCYLLA_PORT') or 9042)
22 )
23
24
25 return ConnectionInfo(host=host, port=port)
26
27
28@pytest.fixture(autouse=True)
29async def _scylla_schema(service_client):
30 response = await service_client.post('/v1/schema/init')
31 assert response.status == 200
32
33 await service_client.post('/v1/kv/truncate')
34 await service_client.post(
35 '/v1/raw',
36 json={'query': 'TRUNCATE examples.events', 'void': True},
37 )