diff --git a/.github/workflows/tests-all.yml b/.github/workflows/test.yml similarity index 97% rename from .github/workflows/tests-all.yml rename to .github/workflows/test.yml index b657230a..aa9d8e67 100644 --- a/.github/workflows/tests-all.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test Suite (Maximal) +name: Test on: pull_request: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 9210f8cd..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Test Suite (Minimal) - -on: pull_request - -# Note: This test runs only on one Python version the minimal pip install - -jobs: - unit-test: - runs-on: ubuntu-22.04 - strategy: - max-parallel: 4 - matrix: - python-version: ['3.11'] - steps: - - uses: actions/checkout@v3 - - - name: Install dependencies - run: make build-dep-ubuntu test-dep-ubuntu - - - name: Set up Python ${{ matrix.python-version }} with caching - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Execute unit-tests - run: make unittest diff --git a/pytest.ini b/pytest.ini index 43822218..7ef1de9a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,6 +5,7 @@ filterwarnings = markers = clickhouse x86_64: mark test as x86-only +asyncio_mode = auto # asynctest is dependency of pytest, I think, but we don't have # control over it anyway. diff --git a/requirements.testing.txt b/requirements.testing.txt index d6fe4018..5ff9a6a1 100644 --- a/requirements.testing.txt +++ b/requirements.testing.txt @@ -4,7 +4,9 @@ pre-commit>=2.20.0 # pre-commit tasks in Makefile need these anyio==3.5.0 pylint==2.17.4 -pytest-asyncio==0.14.0 +# Note breaking change in 0.23. +# https://github.com/pytest-dev/pytest-asyncio/issues/706 +pytest-asyncio==0.21.1 pytest-cov==3.0.0 pytest-mock==3.10.0 pytest-order==1.0.0 diff --git a/tests/integration/coordinator/plugins/clickhouse/test_client.py b/tests/integration/coordinator/plugins/clickhouse/test_client.py index c8f0e0d9..c5702f9f 100644 --- a/tests/integration/coordinator/plugins/clickhouse/test_client.py +++ b/tests/integration/coordinator/plugins/clickhouse/test_client.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from .conftest import ClickHouseCommand, create_clickhouse_service, get_clickhouse_client from astacus.coordinator.plugins.clickhouse.client import ClickHouseClientQueryError from collections.abc import Sequence @@ -17,21 +18,18 @@ ] -@pytest.mark.asyncio async def test_client_execute(clickhouse: Service) -> None: client = get_clickhouse_client(clickhouse) response = cast(Sequence[list[str]], await client.execute(b"SHOW DATABASES")) assert sorted(list(response)) == [["INFORMATION_SCHEMA"], ["default"], ["information_schema"], ["system"]] -@pytest.mark.asyncio async def test_client_execute_on_system_database(clickhouse: Service) -> None: client = get_clickhouse_client(clickhouse) response = await client.execute(b"SELECT currentDatabase()") assert response == [["system"]] -@pytest.mark.asyncio async def test_client_execute_with_empty_response(clickhouse: Service) -> None: # In that case, ClickHouse http protocol doesn't bother with replying with # an empty json dict and instead replies with an empty string. @@ -41,7 +39,6 @@ async def test_client_execute_with_empty_response(clickhouse: Service) -> None: assert response == [] -@pytest.mark.asyncio async def test_client_execute_bounded_connection_failure_time(ports: Ports, clickhouse_command: ClickHouseCommand) -> None: async with create_clickhouse_service(ports, clickhouse_command) as clickhouse: client = get_clickhouse_client(clickhouse, timeout=1.0) @@ -53,7 +50,6 @@ async def test_client_execute_bounded_connection_failure_time(ports: Ports, clic assert elapsed_time < 10.0 -@pytest.mark.asyncio async def test_client_execute_bounded_query_time(clickhouse: Service) -> None: client = get_clickhouse_client(clickhouse, timeout=1.0) start_time = time.monotonic() @@ -63,7 +59,6 @@ async def test_client_execute_bounded_query_time(clickhouse: Service) -> None: assert 1.0 <= elapsed_time < 3.0 -@pytest.mark.asyncio async def test_client_execute_timeout_can_be_customized_per_query(clickhouse: Service) -> None: client = get_clickhouse_client(clickhouse, timeout=10.0) start_time = time.monotonic() @@ -74,7 +69,6 @@ async def test_client_execute_timeout_can_be_customized_per_query(clickhouse: Se assert 1.0 <= elapsed_time < 3.0 -@pytest.mark.asyncio async def test_client_execute_error_returns_status_and_exception_code(clickhouse: Service) -> None: unknown_table_exception_code = 60 client = get_clickhouse_client(clickhouse) diff --git a/tests/integration/coordinator/plugins/clickhouse/test_plugin.py b/tests/integration/coordinator/plugins/clickhouse/test_plugin.py index 21bda772..186b5301 100644 --- a/tests/integration/coordinator/plugins/clickhouse/test_plugin.py +++ b/tests/integration/coordinator/plugins/clickhouse/test_plugin.py @@ -241,7 +241,6 @@ async def setup_cluster_users(clients: Sequence[HttpClickHouseClient]) -> None: await clients[0].execute(b"CREATE USER `z_\\x80_enjoyer`") -@pytest.mark.asyncio async def test_restores_access_entities(restored_cluster: Sequence[ClickHouseClient]) -> None: for client in restored_cluster: assert await client.execute( @@ -263,7 +262,6 @@ async def test_restores_access_entities(restored_cluster: Sequence[ClickHouseCli assert await client.execute(b"SELECT name FROM system.settings_profiles WHERE storage = 'replicated'") == [["érin"]] -@pytest.mark.asyncio async def test_restores_replicated_merge_tree_tables_data(restored_cluster: Sequence[ClickHouseClient]) -> None: s1_data = [[123, "foo"], [456, "bar"]] s2_data = [[789, "baz"]] @@ -273,7 +271,6 @@ async def test_restores_replicated_merge_tree_tables_data(restored_cluster: Sequ assert response == expected_data -@pytest.mark.asyncio async def test_restores_table_with_experimental_types(restored_cluster: Sequence[ClickHouseClient]) -> None: # The JSON type merges the keys in the response, # hence the extra zero-valued entries we don't see in the insert queries. @@ -285,14 +282,12 @@ async def test_restores_table_with_experimental_types(restored_cluster: Sequence assert response == expected_data -@pytest.mark.asyncio async def test_restores_table_with_nullable_key(restored_cluster: Sequence[ClickHouseClient]) -> None: for client in restored_cluster: response = await client.execute(b"SELECT thekey, thedata FROM default.with_nullable_key ORDER BY thekey") assert response == [] -@pytest.mark.asyncio async def test_restores_table_with_nested_fields(restored_cluster: Sequence[ClickHouseClient]) -> None: client = restored_cluster[0] response = await client.execute(b"SELECT thekey, thedata FROM default.nested_not_flatten ORDER BY thekey") @@ -305,7 +300,6 @@ async def test_restores_table_with_nested_fields(restored_cluster: Sequence[Clic assert response == [[123, [4], [5]]] -@pytest.mark.asyncio async def test_restores_function_table(restored_cluster: Sequence[ClickHouseClient]) -> None: client = restored_cluster[0] response = await client.execute(b"SELECT * FROM default.from_function_table") @@ -321,19 +315,16 @@ async def check_object_storage_data(cluster: Sequence[ClickHouseClient]) -> None assert response == expected_data -@pytest.mark.asyncio async def test_restores_url_engine_table(restored_cluster: Sequence[ClickHouseClient]) -> None: for client in restored_cluster: response = await client.execute(b"SELECT create_table_query FROM system.tables WHERE name = 'url_engine_table'") assert response[0][0] == SAMPLE_URL_ENGINE_DDL -@pytest.mark.asyncio async def test_restores_object_storage_data(restored_cluster: Sequence[ClickHouseClient]) -> None: await check_object_storage_data(restored_cluster) -@pytest.mark.asyncio async def test_restores_simple_view(restored_cluster: Sequence[ClickHouseClient]) -> None: s1_data = [[123 * 2], [456 * 2]] s2_data = [[789 * 2]] @@ -343,7 +334,6 @@ async def test_restores_simple_view(restored_cluster: Sequence[ClickHouseClient] assert response == expected_data -@pytest.mark.asyncio async def test_restores_materialized_view_data(restored_cluster: Sequence[ClickHouseClient]) -> None: s1_data = [[123 * 3], [456 * 3]] s2_data = [[789 * 3]] @@ -353,21 +343,18 @@ async def test_restores_materialized_view_data(restored_cluster: Sequence[ClickH assert response == expected_data -@pytest.mark.asyncio async def test_restores_connectivity_between_distributed_servers(restored_cluster: Sequence[ClickHouseClient]) -> None: # This only works if each node can connect to all nodes of the cluster named after the Distributed database for client in restored_cluster: assert await client.execute(b"SELECT * FROM clusterAllReplicas('default', system.one) ") == [[0], [0], [0]] -@pytest.mark.asyncio async def test_does_not_restore_log_tables_data(restored_cluster: Sequence[ClickHouseClient]) -> None: # We restored the table structure but not the data for client in restored_cluster: assert await client.execute(b"SELECT thekey, thedata FROM default.memory") == [] -@pytest.mark.asyncio async def test_cleanup_does_not_break_object_storage_disk_files( ports: Ports, clickhouse_command: ClickHouseCommand, @@ -404,7 +391,6 @@ async def test_cleanup_does_not_break_object_storage_disk_files( await check_object_storage_data(clients) -@pytest.mark.asyncio async def test_restores_integration_tables(restored_cluster: Sequence[ClickHouseClient]) -> None: for client in restored_cluster: assert await table_exists(client, "default.postgresql") diff --git a/tests/integration/coordinator/plugins/clickhouse/test_replication.py b/tests/integration/coordinator/plugins/clickhouse/test_replication.py index 2c3a2a91..5595bc06 100644 --- a/tests/integration/coordinator/plugins/clickhouse/test_replication.py +++ b/tests/integration/coordinator/plugins/clickhouse/test_replication.py @@ -2,6 +2,7 @@ Copyright (c) 2022 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.clickhouse.replication import get_shard_and_replica from tests.integration.conftest import create_zookeeper, Ports from tests.integration.coordinator.plugins.clickhouse.conftest import ( @@ -19,7 +20,6 @@ ] -@pytest.mark.asyncio async def test_get_shard_and_replica(ports: Ports, clickhouse_command: ClickHouseCommand, minio_bucket: MinioBucket) -> None: async with create_zookeeper(ports) as zookeeper: async with create_clickhouse_cluster( diff --git a/tests/integration/coordinator/plugins/clickhouse/test_steps.py b/tests/integration/coordinator/plugins/clickhouse/test_steps.py index 32698994..5d8525b3 100644 --- a/tests/integration/coordinator/plugins/clickhouse/test_steps.py +++ b/tests/integration/coordinator/plugins/clickhouse/test_steps.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from .conftest import ClickHouseCommand, create_clickhouse_cluster, get_clickhouse_client, MinioBucket from astacus.coordinator.cluster import Cluster from astacus.coordinator.plugins.base import StepsContext @@ -21,7 +22,6 @@ ] -@pytest.mark.asyncio async def test_retrieve_tables(ports: Ports, clickhouse_command: ClickHouseCommand, minio_bucket: MinioBucket) -> None: async with create_zookeeper(ports) as zookeeper: # We need a "real" cluster to be able to use Replicated databases diff --git a/tests/integration/coordinator/plugins/clickhouse/test_zookeeper.py b/tests/integration/coordinator/plugins/clickhouse/test_zookeeper.py index f5874b37..3790293c 100644 --- a/tests/integration/coordinator/plugins/clickhouse/test_zookeeper.py +++ b/tests/integration/coordinator/plugins/clickhouse/test_zookeeper.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.zookeeper import ( KazooZooKeeperClient, NodeExistsError, @@ -42,40 +43,34 @@ def fixture_znode(zookeeper: Service) -> ZNode: return znode -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_get(zookeeper_client: KazooZooKeeperClient, znode: ZNode): async with zookeeper_client.connect() as connection: assert await connection.get(znode.path) == znode.content -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_get_missing_node_fails(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: with pytest.raises(NoNodeError): assert await connection.get("/does/not/exist") -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_get_children(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: assert await connection.get_children("/zookeeper") == ["config", "quota"] -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_get_children_of_missing_node_fails(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: with pytest.raises(NoNodeError): assert await connection.get_children("/does/not/exists") -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_try_create(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: assert await connection.try_create("/new/try_create", b"new_content") is True assert await connection.get("/new/try_create") == b"new_content" -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_try_create_failure(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: await connection.create("/new/try_create_failure", b"content") @@ -83,21 +78,18 @@ async def test_kazoo_zookeeper_client_try_create_failure(zookeeper_client: Kazoo assert await connection.get("/new/try_create_failure") == b"content" -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_create(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: await connection.create("/new/create", b"content") assert await connection.get("/new/create") == b"content" -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_create_existing_node_fails(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: with pytest.raises(NodeExistsError): await connection.create("/zookeeper", b"content") -@pytest.mark.asyncio async def test_kazoo_zookeeper_transaction(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: transaction = connection.transaction() @@ -108,7 +100,6 @@ async def test_kazoo_zookeeper_transaction(zookeeper_client: KazooZooKeeperClien assert await connection.get("/transaction_2") == b"content" -@pytest.mark.asyncio async def test_kazoo_zookeeper_failing_transaction(zookeeper_client: KazooZooKeeperClient) -> None: async with zookeeper_client.connect() as connection: await connection.create("/failing_transaction_2", b"old_content") @@ -123,7 +114,6 @@ async def test_kazoo_zookeeper_failing_transaction(zookeeper_client: KazooZooKee assert isinstance(raised.value.results[2], RuntimeInconsistency) -@pytest.mark.asyncio async def test_kazoo_zookeeper_client_bounded_failure_time(ports: Ports) -> None: async with create_zookeeper(ports) as zookeeper: zookeeper_client = KazooZooKeeperClient(hosts=[get_kazoo_host(zookeeper)], user=None, timeout=1) diff --git a/tests/integration/coordinator/plugins/flink/test_steps.py b/tests/integration/coordinator/plugins/flink/test_steps.py index 2db6825d..64fd3b32 100644 --- a/tests/integration/coordinator/plugins/flink/test_steps.py +++ b/tests/integration/coordinator/plugins/flink/test_steps.py @@ -2,6 +2,7 @@ Copyright (c) 2022 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.base import StepsContext from astacus.coordinator.plugins.flink.manifest import FlinkManifest from astacus.coordinator.plugins.flink.steps import FlinkManifestStep, RestoreDataStep, RetrieveDataStep @@ -9,10 +10,7 @@ from unittest.mock import Mock from uuid import uuid4 -import pytest - -@pytest.mark.asyncio async def test_restore_data(zookeeper_client: KazooZooKeeperClient) -> None: table_id1 = str(uuid4()).partition("-")[0] table_id2 = str(uuid4()).partition("-")[0] diff --git a/tests/system/test_config_reload.py b/tests/system/test_config_reload.py index 67f71613..c3ce883a 100644 --- a/tests/system/test_config_reload.py +++ b/tests/system/test_config_reload.py @@ -11,7 +11,6 @@ @pytest.mark.order("last") -@pytest.mark.asyncio def test_reload_config(tmpdir, rootdir: str, astacus1: TestNode, astacus2: TestNode, astacus3: TestNode) -> None: # Update the root_globs config of the first node create_astacus_config(tmpdir=tmpdir, node=astacus1, plugin_config={"root_globs": ["*.foo"]}) diff --git a/tests/unit/common/cassandra/test_client.py b/tests/unit/common/cassandra/test_client.py index dfb9ea3f..2af099d0 100644 --- a/tests/unit/common/cassandra/test_client.py +++ b/tests/unit/common/cassandra/test_client.py @@ -54,7 +54,6 @@ def test_cassandra_client(mocker: MockFixture, ssl: bool) -> None: assert isinstance(session, client_module.CassandraSession) -@pytest.mark.asyncio async def test_cassandra_client_run(mocker: MockFixture): client = create_client(mocker) diff --git a/tests/unit/common/test_limiter.py b/tests/unit/common/test_limiter.py index 8682c5d8..cf5a836b 100644 --- a/tests/unit/common/test_limiter.py +++ b/tests/unit/common/test_limiter.py @@ -18,7 +18,6 @@ (3, ["s1", "s2", "s3", "e2", "e3", "e1"]), ], ) -@pytest.mark.asyncio async def test_limiter(limit: int, expected_trace: Sequence[str]) -> None: trace = [] @@ -44,7 +43,6 @@ async def add_trace(start: str, sleep: float, stop: str): (3, ["s1", "s2", "s3", "e2", "e3", "e1"]), ], ) -@pytest.mark.asyncio async def test_gather_limited(limit: int, expected_trace: Sequence[str]) -> None: trace = [] diff --git a/tests/unit/common/test_op.py b/tests/unit/common/test_op.py index 7241286f..44dcf370 100644 --- a/tests/unit/common/test_op.py +++ b/tests/unit/common/test_op.py @@ -6,6 +6,7 @@ astacus.common.op tests that do not fit elsewhere """ + from astacus.common import op from astacus.common.exceptions import ExpiredOperationException from astacus.common.statsd import StatsClient @@ -15,7 +16,6 @@ import pytest -@pytest.mark.asyncio @pytest.mark.parametrize( "fun_ex,expect_status,expect_ex", [ diff --git a/tests/unit/common/test_op_stats.py b/tests/unit/common/test_op_stats.py index 2fe3ed57..29d2d1f7 100644 --- a/tests/unit/common/test_op_stats.py +++ b/tests/unit/common/test_op_stats.py @@ -6,6 +6,7 @@ Test stats sending. """ + from astacus.common import op from astacus.common.ipc import Plugin from astacus.common.statsd import StatsClient @@ -19,8 +20,6 @@ from starlette.datastructures import URL from unittest.mock import patch -import pytest - class DummyStep(Step[bool]): async def run_step(self, cluster: Cluster, context: StepsContext) -> bool: @@ -39,7 +38,6 @@ class DummyStep3(DummyStep): pass -@pytest.mark.asyncio async def test_op_stats() -> None: stats = StatsClient(config=None) coordinator = Coordinator( diff --git a/tests/unit/common/test_statsd.py b/tests/unit/common/test_statsd.py index da8097eb..44faefaf 100644 --- a/tests/unit/common/test_statsd.py +++ b/tests/unit/common/test_statsd.py @@ -7,13 +7,13 @@ This could be broader, but at least minimal functionality is tested here. """ + from __future__ import annotations from astacus.common import statsd from typing import Any import asyncio -import pytest import socket @@ -25,7 +25,6 @@ def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: self.received_queue.put_nowait(data) -@pytest.mark.asyncio async def test_statsd() -> None: loop = asyncio.get_running_loop() received: asyncio.Queue[bytes] = asyncio.Queue() diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py index 4db4bb03..4af1fa2a 100644 --- a/tests/unit/common/test_utils.py +++ b/tests/unit/common/test_utils.py @@ -46,14 +46,12 @@ def test_build_netloc_adds_port_to_ipv6() -> None: assert build_netloc("::1", 1234) == "[::1]:1234" -@pytest.mark.asyncio async def test_httpx_request_connect_failure(): # Known (most likely) unreachable local IP address r = await utils.httpx_request("http://127.0.0.42:12345/foo", caller="test") assert r is None -@pytest.mark.asyncio async def test_async_sleeper() -> None: sleeper = AsyncSleeper() @@ -70,7 +68,6 @@ async def wait_and_wake(): task.done() -@pytest.mark.asyncio async def test_exponential_backoff(mocker: MockerFixture) -> None: _waits: list[float] = [] base = 42 diff --git a/tests/unit/coordinator/plugins/cassandra/test_plugin.py b/tests/unit/coordinator/plugins/cassandra/test_plugin.py index 81140091..0e73b14a 100644 --- a/tests/unit/coordinator/plugins/cassandra/test_plugin.py +++ b/tests/unit/coordinator/plugins/cassandra/test_plugin.py @@ -23,7 +23,6 @@ def fixture_cplugin(cassandra_test_config: CassandraTestConfig) -> plugin.Cassan ) -@pytest.mark.asyncio async def test_step_cassandrasubop(mocker: MockerFixture) -> None: mocker.patch.object(plugin, "run_subop") @@ -34,7 +33,6 @@ async def test_step_cassandrasubop(mocker: MockerFixture) -> None: @pytest.mark.parametrize("success", [False, True]) -@pytest.mark.asyncio async def test_step_cassandra_validate_configuration(mocker: MockerFixture, success: bool) -> None: step = plugin.ValidateConfigurationStep(nodes=[]) context = Mock() diff --git a/tests/unit/coordinator/plugins/cassandra/test_restore_steps.py b/tests/unit/coordinator/plugins/cassandra/test_restore_steps.py index c219e1ce..05d4236a 100644 --- a/tests/unit/coordinator/plugins/cassandra/test_restore_steps.py +++ b/tests/unit/coordinator/plugins/cassandra/test_restore_steps.py @@ -53,7 +53,6 @@ def _coordinator_node(node_index: int) -> CoordinatorNode: @pytest.mark.parametrize("override_tokens", [False, True]) @pytest.mark.parametrize("replace_backup_nodes", [False, True]) -@pytest.mark.asyncio async def test_step_start_cassandra(mocker: MockerFixture, override_tokens: bool, replace_backup_nodes: bool) -> None: plugin_manifest = CassandraManifest( cassandra_schema=CassandraSchema(keyspaces=[]), @@ -109,7 +108,6 @@ def get_result(cl): ) -@pytest.mark.asyncio async def test_step_stop_replaced_nodes(mocker: MockerFixture) -> None: # Node 3 is replacing node 1. manifest_nodes = [_manifest_node(1), _manifest_node(2)] @@ -160,7 +158,6 @@ async def __anext__(self): @pytest.mark.parametrize("steps,success", [([True], True), ([False, True], True), ([False], False)]) -@pytest.mark.asyncio async def test_step_wait_cassandra_up(mocker: MockerFixture, steps: list[bool], success: bool) -> None: get_schema_steps = steps[:] @@ -188,7 +185,6 @@ async def get_schema_hash(cluster, nodes): await step.run_step(cluster, context) -@pytest.mark.asyncio @pytest.mark.parametrize( "replaced_node_step, expected_nodes", [(restore_steps.StopReplacedNodesStep, [_coordinator_node(2)]), (None, None)] ) diff --git a/tests/unit/coordinator/plugins/cassandra/test_utils.py b/tests/unit/coordinator/plugins/cassandra/test_utils.py index d0948c91..2d47090c 100644 --- a/tests/unit/coordinator/plugins/cassandra/test_utils.py +++ b/tests/unit/coordinator/plugins/cassandra/test_utils.py @@ -13,7 +13,6 @@ @pytest.mark.parametrize("start_ok", [False, True]) -@pytest.mark.asyncio async def test_run_subop(mocker: MockerFixture, start_ok: bool) -> None: async def request_from_nodes(*args, **kwargs): if start_ok: @@ -42,7 +41,6 @@ async def wait_successful_results(*, start_results, result_class): ([1], (1, "")), ], ) -@pytest.mark.asyncio async def test_get_schema_hash(mocker: MockerFixture, hashes: list[int], result: tuple[str, str]) -> None: mocker.patch.object(utils, "run_subop", return_value=[Mock(schema_hash=hash) for hash in hashes]) actual_result = await utils.get_schema_hash(mocker.Mock(nodes=[])) diff --git a/tests/unit/coordinator/plugins/clickhouse/test_client.py b/tests/unit/coordinator/plugins/clickhouse/test_client.py index c2483ed5..e97882c6 100644 --- a/tests/unit/coordinator/plugins/clickhouse/test_client.py +++ b/tests/unit/coordinator/plugins/clickhouse/test_client.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.clickhouse.client import ( ClickHouseClientQueryError, escape_sql_identifier, @@ -15,7 +16,6 @@ pytestmark = [pytest.mark.clickhouse] -@pytest.mark.asyncio async def test_successful_execute_returns_rows() -> None: client = HttpClickHouseClient(host="example.org", port=9000) with respx.mock: @@ -31,7 +31,6 @@ async def test_successful_execute_returns_rows() -> None: assert response == [["system"], ["defaultdb"]] -@pytest.mark.asyncio async def test_failing_execute_raises_an_exception() -> None: client = HttpClickHouseClient(host="example.org", port=9000) with respx.mock: @@ -40,7 +39,6 @@ async def test_failing_execute_raises_an_exception() -> None: await client.execute(b"SHOW DATABASES") -@pytest.mark.asyncio async def test_sends_authentication_headers() -> None: client = HttpClickHouseClient(host="example.org", port=9000, username="user", password="password") with respx.mock: @@ -51,7 +49,6 @@ async def test_sends_authentication_headers() -> None: assert request.headers["x-clickhouse-key"] == "password" -@pytest.mark.asyncio async def test_sends_session_id_as_parameter() -> None: client = HttpClickHouseClient(host="example.org", port=9000) with respx.mock: diff --git a/tests/unit/coordinator/plugins/clickhouse/test_macros.py b/tests/unit/coordinator/plugins/clickhouse/test_macros.py index 0f9a677e..a467d4d2 100644 --- a/tests/unit/coordinator/plugins/clickhouse/test_macros.py +++ b/tests/unit/coordinator/plugins/clickhouse/test_macros.py @@ -2,6 +2,7 @@ Copyright (c) 2022 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.clickhouse.client import StubClickHouseClient from astacus.coordinator.plugins.clickhouse.macros import fetch_server_macros, MacroExpansionError, Macros, MACROS_LIST_QUERY from base64 import b64encode @@ -95,7 +96,6 @@ def test_as_mapping() -> None: assert macros.as_mapping() == {b"foo": b"123", b"bar": b"456"} -@pytest.mark.asyncio async def test_fetch_server_macros() -> None: client = StubClickHouseClient() client.set_response( diff --git a/tests/unit/coordinator/plugins/clickhouse/test_steps.py b/tests/unit/coordinator/plugins/clickhouse/test_steps.py index 5cfa241e..615becb2 100644 --- a/tests/unit/coordinator/plugins/clickhouse/test_steps.py +++ b/tests/unit/coordinator/plugins/clickhouse/test_steps.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from astacus.common.asyncstorage import AsyncJsonStorage from astacus.common.exceptions import TransientException from astacus.common.ipc import BackupManifest, ManifestMin, Plugin, SnapshotFile, SnapshotResult, SnapshotState @@ -160,7 +161,6 @@ def mock_clickhouse_client() -> mock.Mock: return mock_client -@pytest.mark.asyncio @pytest.mark.parametrize( "clickhouse_count,coordinator_count,success", [ @@ -205,7 +205,6 @@ async def create_zookeper_access_entities(zookeeper_client: ZooKeeperClient) -> ) -@pytest.mark.asyncio async def test_retrieve_access_entities() -> None: zookeeper_client = FakeZooKeeperClient() await create_zookeper_access_entities(zookeeper_client) @@ -235,7 +234,6 @@ async def inject_fault(self) -> None: self.calls_until_failure -= 1 -@pytest.mark.asyncio async def test_retrieve_access_entities_fails_from_concurrent_updates() -> None: zookeeper_client = TrappedZooKeeperClient() await create_zookeper_access_entities(zookeeper_client) @@ -251,7 +249,6 @@ async def test_retrieve_access_entities_fails_from_concurrent_updates() -> None: await step.run_step(Cluster(nodes=[]), StepsContext()) -@pytest.mark.asyncio async def test_retrieve_tables() -> None: clients: Sequence[StubClickHouseClient] = [StubClickHouseClient(), StubClickHouseClient()] clients[0].set_response( @@ -340,7 +337,6 @@ async def test_retrieve_tables() -> None: assert tables == SAMPLE_TABLES -@pytest.mark.asyncio async def test_retrieve_tables_without_any_database_or_table() -> None: clients = [StubClickHouseClient(), StubClickHouseClient()] clients[0].set_response(DATABASES_LIST_QUERY, []) @@ -350,7 +346,6 @@ async def test_retrieve_tables_without_any_database_or_table() -> None: assert await step.run_step(Cluster(nodes=[]), context) == ([], []) -@pytest.mark.asyncio async def test_retrieve_tables_without_any_table() -> None: clients = [StubClickHouseClient(), StubClickHouseClient()] clients[0].set_response( @@ -383,7 +378,6 @@ async def test_retrieve_tables_without_any_table() -> None: assert tables == [] -@pytest.mark.asyncio async def test_retrieve_macros() -> None: clients = [StubClickHouseClient(), StubClickHouseClient()] for ( @@ -417,7 +411,6 @@ def create_remote_file(path: str, remote_path: str) -> SnapshotFile: ) -@pytest.mark.asyncio async def test_collect_object_storage_file_steps() -> None: disks = Disks.from_disk_configs( [ @@ -464,7 +457,6 @@ async def test_collect_object_storage_file_steps() -> None: assert await step.run_step(Cluster(nodes=[]), context) == SAMPLE_OBJET_STORAGE_FILES -@pytest.mark.asyncio async def test_move_frozen_parts_steps() -> None: disks = Disks.from_disk_configs( [ @@ -514,7 +506,6 @@ async def test_move_frozen_parts_steps() -> None: ) -@pytest.mark.asyncio async def test_create_clickhouse_manifest() -> None: step = PrepareClickHouseManifestStep() context = StepsContext() @@ -524,7 +515,6 @@ async def test_create_clickhouse_manifest() -> None: assert await step.run_step(Cluster(nodes=[]), context) == SAMPLE_MANIFEST_ENCODED -@pytest.mark.asyncio async def test_remove_frozen_tables_step_using_system_unfreeze() -> None: first_client, second_client = mock_clickhouse_client(), mock_clickhouse_client() step = RemoveFrozenTablesStep( @@ -539,7 +529,6 @@ async def test_remove_frozen_tables_step_using_system_unfreeze() -> None: assert [call.args[0] for call in second_client.execute.mock_calls] == client_queries -@pytest.mark.asyncio @pytest.mark.parametrize("all_clients", [True, False]) @pytest.mark.parametrize("operation", ["FREEZE", "UNFREEZE"]) async def test_freezes_all_mergetree_tables_listed_in_manifest(all_clients: bool, operation: str) -> None: @@ -582,7 +571,6 @@ def b64_str(b: bytes) -> str: return b64encode(b).decode() -@pytest.mark.asyncio async def test_parse_clickhouse_manifest() -> None: step = ClickHouseManifestStep() context = StepsContext() @@ -641,7 +629,6 @@ async def test_parse_clickhouse_manifest() -> None: ) -@pytest.mark.asyncio async def test_list_database_replicas_step() -> None: step = ListDatabaseReplicasStep() cluster = Cluster(nodes=[CoordinatorNode(url="node1"), CoordinatorNode(url="node2")]) @@ -677,7 +664,6 @@ async def test_list_database_replicas_step() -> None: @pytest.mark.parametrize("missing_macro", [b"shard", b"replica"]) -@pytest.mark.asyncio async def test_list_database_replicas_step_fails_on_missing_macro(missing_macro: bytes) -> None: server_1_macros = Macros() server_2_macros = Macros() @@ -704,7 +690,6 @@ async def test_list_database_replicas_step_fails_on_missing_macro(missing_macro: await step.run_step(cluster, context) -@pytest.mark.asyncio async def test_list_sync_database_replicas_step() -> None: zookeeper_client = FakeZooKeeperClient() async with zookeeper_client.connect() as connection: @@ -757,7 +742,6 @@ async def advance_node2(): assert await connection.get("/clickhouse/databases/db%2Done/replicas/all|node2/log_ptr") == b"100" -@pytest.mark.asyncio async def test_creates_all_replicated_databases_and_tables_in_manifest() -> None: clients = [mock_clickhouse_client(), mock_clickhouse_client()] step = RestoreReplicatedDatabasesStep( @@ -812,7 +796,6 @@ async def test_creates_all_replicated_databases_and_tables_in_manifest() -> None assert [call.args[0] for call in clients[1].execute.mock_calls] == second_client_queries -@pytest.mark.asyncio async def test_creates_all_replicated_databases_and_tables_in_manifest_with_custom_settings() -> None: client = mock_clickhouse_client() step = RestoreReplicatedDatabasesStep( @@ -857,7 +840,6 @@ async def test_creates_all_replicated_databases_and_tables_in_manifest_with_cust assert [call.args[0] for call in client.execute.mock_calls] == first_client_queries -@pytest.mark.asyncio async def test_drops_each_database_on_all_servers_before_recreating_it() -> None: # We use the same client twice to record the global sequence of queries across all servers client1 = mock_clickhouse_client() @@ -905,7 +887,6 @@ async def test_drops_each_database_on_all_servers_before_recreating_it() -> None assert all(query in client1_queries or client2_queries for query in queries_expected_on_a_single_node) -@pytest.mark.asyncio async def test_creates_all_access_entities_in_manifest() -> None: client = FakeZooKeeperClient() step = RestoreAccessEntitiesStep(zookeeper_client=client, access_entities_path="/clickhouse/access") @@ -915,7 +896,6 @@ async def test_creates_all_access_entities_in_manifest() -> None: await check_restored_entities(client) -@pytest.mark.asyncio async def test_creating_all_access_entities_can_be_retried() -> None: client = FakeZooKeeperClient() step = RestoreAccessEntitiesStep(zookeeper_client=client, access_entities_path="/clickhouse/access") @@ -954,7 +934,6 @@ async def check_restored_entities(client: ZooKeeperClient) -> None: assert await connection.get(f"/clickhouse/access/uuid/{str(uuid.UUID(int=6))}") == b"ATTACH USER \x80 ..." -@pytest.mark.asyncio async def test_restore_replica() -> None: zookeeper_client = FakeZooKeeperClient() client_1 = mock_clickhouse_client() @@ -995,7 +974,6 @@ async def test_restore_replica() -> None: check_each_pair_of_calls_has_the_same_session_id(client.mock_calls) -@pytest.mark.asyncio async def test_restore_object_storage_files() -> None: object_storage_items = [ ObjectStorageItem(key=file.path, last_modified=datetime.datetime(2020, 1, 2, tzinfo=datetime.timezone.utc)) @@ -1013,7 +991,6 @@ async def test_restore_object_storage_files() -> None: assert await target_object_storage.list_items() == object_storage_items -@pytest.mark.asyncio async def test_restore_object_storage_files_does_nothing_is_storages_have_same_config() -> None: same_object_storage = mock.Mock(spec_set=AsyncObjectStorage) source_disks = Disks(disks=[create_object_storage_disk("remote", same_object_storage)]) @@ -1026,7 +1003,6 @@ async def test_restore_object_storage_files_does_nothing_is_storages_have_same_c same_object_storage.copy_items_from.assert_not_called() -@pytest.mark.asyncio async def test_restore_object_storage_files_fails_if_source_disk_has_no_object_storage_config() -> None: source_disks = Disks(disks=[create_object_storage_disk("remote", None)]) target_disks = Disks(disks=[create_object_storage_disk("remote", MemoryAsyncObjectStorage())]) @@ -1038,7 +1014,6 @@ async def test_restore_object_storage_files_fails_if_source_disk_has_no_object_s await step.run_step(cluster, context) -@pytest.mark.asyncio async def test_restore_object_storage_files_fails_if_target_disk_has_no_object_storage_config() -> None: source_disks = Disks(disks=[create_object_storage_disk("remote", MemoryAsyncObjectStorage())]) target_disks = Disks(disks=[create_object_storage_disk("remote", None)]) @@ -1050,7 +1025,6 @@ async def test_restore_object_storage_files_fails_if_target_disk_has_no_object_s await step.run_step(cluster, context) -@pytest.mark.asyncio async def test_attaches_all_mergetree_parts_in_manifest() -> None: client_1 = mock_clickhouse_client() client_2 = mock_clickhouse_client() @@ -1126,7 +1100,6 @@ async def test_attaches_all_mergetree_parts_in_manifest() -> None: check_each_pair_of_calls_has_the_same_session_id(client_2.mock_calls) -@pytest.mark.asyncio async def test_sync_replicas_for_replicated_mergetree_tables() -> None: clients = [mock_clickhouse_client(), mock_clickhouse_client()] step = SyncTableReplicasStep(clients, sync_timeout=180, max_concurrent_sync_per_node=10) @@ -1152,7 +1125,6 @@ def check_each_pair_of_calls_has_the_same_session_id(mock_calls: Sequence[MockCa assert session_ids[start_index] == session_ids[start_index + 1] -@pytest.mark.asyncio async def test_delete_object_storage_files_step(tmp_path: Path) -> None: object_storage = MemoryAsyncObjectStorage.from_items( [ @@ -1229,7 +1201,6 @@ async def test_delete_object_storage_files_step(tmp_path: Path) -> None: ] -@pytest.mark.asyncio async def test_get_versions_step() -> None: client_1 = mock_clickhouse_client() client_1.execute.return_value = [["23.8.6.1"]] @@ -1241,7 +1212,6 @@ async def test_get_versions_step() -> None: assert result == [(23, 8), (23, 3)] -@pytest.mark.asyncio @pytest.mark.parametrize( "versions,called_node_indicies", [ diff --git a/tests/unit/coordinator/plugins/test_base.py b/tests/unit/coordinator/plugins/test_base.py index 631923fc..3deb9167 100644 --- a/tests/unit/coordinator/plugins/test_base.py +++ b/tests/unit/coordinator/plugins/test_base.py @@ -3,6 +3,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from astacus.common import ipc, utils from astacus.common.asyncstorage import AsyncHexDigestStorage, AsyncJsonStorage from astacus.common.ipc import ManifestMin, Plugin, SnapshotHash @@ -132,7 +133,6 @@ def manifest_with_hashes(hashes: dict[str, bytes], index: int) -> ipc.BackupMani ) -@pytest.mark.asyncio @pytest.mark.parametrize( "node_features,expected_request", [ @@ -196,7 +196,6 @@ async def test_upload_step_uses_new_request_if_supported( } -@pytest.mark.asyncio @pytest.mark.parametrize( "retention,kept_backups", [ @@ -241,7 +240,6 @@ async def test_compute_kept_backups( } -@pytest.mark.asyncio @pytest.mark.parametrize( "explicit_delete,expected_kept_backups", [ @@ -275,7 +273,6 @@ async def test_compute_kept_deltas( assert {b.filename for b in kept_backups} == expected_kept_backups -@pytest.mark.asyncio async def test_delete_backup_manifests(single_node_cluster: Cluster, context: StepsContext) -> None: json_items: dict[str, bytes] = { "b1": b"", @@ -301,7 +298,6 @@ class DeleteBackupManifestsParam: test_id: str -@pytest.mark.asyncio @pytest.mark.parametrize( "p", [ @@ -338,7 +334,6 @@ async def test_delete_backup_and_delta_manifests( assert set(json_items.keys()) == p.expected_remaining -@pytest.mark.asyncio @pytest.mark.parametrize( "kept_backups,stored_hashes,expected_hashes", [ @@ -369,7 +364,6 @@ async def test_delete_dangling_hexdigests_step( assert stored_hashes == expected_hashes -@pytest.mark.asyncio async def test_delete_backup_and_delta_manifests_raises_when_delta_steps_are_missing( single_node_cluster: Cluster, context: StepsContext ) -> None: @@ -381,7 +375,6 @@ async def test_delete_backup_and_delta_manifests_raises_when_delta_steps_are_mis await step.run_step(single_node_cluster, context) -@pytest.mark.asyncio async def test_upload_manifest_step_generates_correct_backup_name( single_node_cluster: Cluster, context: StepsContext, @@ -396,7 +389,6 @@ async def test_upload_manifest_step_generates_correct_backup_name( assert "backup-2020-01-07T05:00:00+00:00" in async_json_storage.storage.items -@pytest.mark.asyncio @pytest.mark.parametrize( "node_features,expected_request", [ @@ -452,7 +444,6 @@ class TestListDeltasParam: expected_deltas: list[str] -@pytest.mark.asyncio @pytest.mark.parametrize( "p", [ diff --git a/tests/unit/coordinator/plugins/test_m3db.py b/tests/unit/coordinator/plugins/test_m3db.py index 67d4ea58..cea4481d 100644 --- a/tests/unit/coordinator/plugins/test_m3db.py +++ b/tests/unit/coordinator/plugins/test_m3db.py @@ -6,6 +6,7 @@ Test that the plugin m3 specific flow (backup + restore) works """ + from astacus.common import ipc from astacus.common.etcd import b64encode_to_str, ETCDClient from astacus.common.statsd import StatsClient @@ -96,7 +97,6 @@ def fixture_etcd_client(plugin: M3DBPlugin) -> ETCDClient: return ETCDClient(plugin.etcd_url) -@pytest.mark.asyncio @pytest.mark.parametrize("fail_at", BACKUP_FAILS) async def test_m3_backup(coordinator: Coordinator, plugin: M3DBPlugin, etcd_client: ETCDClient, fail_at: int | None): etcd_prefixes = get_etcd_prefixes(plugin.environment) @@ -134,7 +134,6 @@ class RestoreTest: partial: bool = False -@pytest.mark.asyncio @pytest.mark.parametrize("rt", [RestoreTest(fail_at=i) for i in range(3)] + [RestoreTest()]) async def test_m3_restore(coordinator: Coordinator, plugin: M3DBPlugin, etcd_client: ETCDClient, rt: RestoreTest) -> None: partial_restore_nodes: Sequence[ipc.PartialRestoreRequestNode] | None = None diff --git a/tests/unit/coordinator/plugins/test_zookeeper.py b/tests/unit/coordinator/plugins/test_zookeeper.py index c22b5493..9f3e22a8 100644 --- a/tests/unit/coordinator/plugins/test_zookeeper.py +++ b/tests/unit/coordinator/plugins/test_zookeeper.py @@ -2,6 +2,7 @@ Copyright (c) 2021 Aiven Ltd See LICENSE for details """ + from astacus.coordinator.plugins.zookeeper import ( ChangeWatch, FakeZooKeeperClient, @@ -18,7 +19,6 @@ pytestmark = [pytest.mark.clickhouse] -@pytest.mark.asyncio async def test_fake_zookeeper_client_create_includes_parents() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -28,7 +28,6 @@ async def test_fake_zookeeper_client_create_includes_parents() -> None: assert await connection.get("/path/to/some") == b"" -@pytest.mark.asyncio async def test_fake_zookeeper_client_create_then_get() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -37,7 +36,6 @@ async def test_fake_zookeeper_client_create_then_get() -> None: assert await connection.get("/path/to_key/") == b"content" -@pytest.mark.asyncio async def test_fake_zookeeper_client_create_then_set() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -46,7 +44,6 @@ async def test_fake_zookeeper_client_create_then_set() -> None: assert await connection.get("/path/to_key/") == b"new content" -@pytest.mark.asyncio async def test_fake_zookeeper_client_create_existing_node_fails() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -55,7 +52,6 @@ async def test_fake_zookeeper_client_create_existing_node_fails() -> None: await connection.create("/path/to_key", b"content") -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_missing_node_fails() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -63,7 +59,6 @@ async def test_fake_zookeeper_client_get_missing_node_fails() -> None: await connection.get("/path/to_key") -@pytest.mark.asyncio async def test_fake_zookeeper_client_set_missing_node_fails() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -71,7 +66,6 @@ async def test_fake_zookeeper_client_set_missing_node_fails() -> None: await connection.set("/path/to_key", b"content") -@pytest.mark.asyncio async def test_fake_zookeeper_client_delete() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -80,7 +74,6 @@ async def test_fake_zookeeper_client_delete() -> None: assert not await connection.exists("/path/to_key") -@pytest.mark.asyncio async def test_fake_zookeeper_client_delete_fails_if_not_exist() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -88,7 +81,6 @@ async def test_fake_zookeeper_client_delete_fails_if_not_exist() -> None: await connection.delete("/path/to_key") -@pytest.mark.asyncio async def test_fake_zookeeper_client_delete_fails_if_has_children() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -98,7 +90,6 @@ async def test_fake_zookeeper_client_delete_fails_if_has_children() -> None: await connection.delete("/path/to_key") -@pytest.mark.asyncio async def test_fake_zookeeper_client_delete_recursive() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -111,14 +102,12 @@ async def test_fake_zookeeper_client_delete_recursive() -> None: assert not await connection.exists("/path/to_key/sub2") -@pytest.mark.asyncio async def test_fake_zookeeper_client_root_exists() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: assert await connection.get("") == b"" -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_children() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -128,7 +117,6 @@ async def test_fake_zookeeper_client_get_children() -> None: assert await connection.get_children("/group/of") == ["key_1", "key_2", "key_3"] -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_children_of_missing_node_fails() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -136,7 +124,6 @@ async def test_fake_zookeeper_client_get_children_of_missing_node_fails() -> Non await connection.get_children("/group/of") -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_watch_on_child() -> None: client = FakeZooKeeperClient() change_watch = ChangeWatch() @@ -148,7 +135,6 @@ async def test_fake_zookeeper_client_get_watch_on_child() -> None: assert change_watch.has_changed -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_watch_on_set() -> None: client = FakeZooKeeperClient() change_watch = ChangeWatch() @@ -160,7 +146,6 @@ async def test_fake_zookeeper_client_get_watch_on_set() -> None: assert change_watch.has_changed -@pytest.mark.asyncio async def test_fake_zookeeper_client_get_children_watch() -> None: client = FakeZooKeeperClient() change_watch = ChangeWatch() @@ -172,7 +157,6 @@ async def test_fake_zookeeper_client_get_children_watch() -> None: assert change_watch.has_changed -@pytest.mark.asyncio async def test_fake_zookeeper_transaction() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -184,7 +168,6 @@ async def test_fake_zookeeper_transaction() -> None: assert await connection.get("/key_2") == b"content" -@pytest.mark.asyncio async def test_fake_zookeeper_transaction_is_atomic() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -202,7 +185,6 @@ async def test_fake_zookeeper_transaction_is_atomic() -> None: assert repr(raised.value.results) == repr(expected_errors) -@pytest.mark.asyncio async def test_fake_zookeeper_transaction_does_not_implicitly_create_parents() -> None: client = FakeZooKeeperClient() async with client.connect() as connection: @@ -212,7 +194,6 @@ async def test_fake_zookeeper_transaction_does_not_implicitly_create_parents() - await transaction.commit() -@pytest.mark.asyncio async def test_fake_zookeeper_transaction_generates_trigger() -> None: client = FakeZooKeeperClient() change_watch = ChangeWatch()