ydb-platform / ydb-platform/ydb-python-sdk

bug: driver.wait raises timeout in tests with pytest.mark.now

Open
#545 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
102
Forks
75
Avg merge
1d 23h
Merged PRs (30d)
13

Description

Bug Report

YDB Python SDK version:

3.18.2

Environment

linux

Current behavior:
I'm running the local YDB in the tests. When I use "pytest.mark.now", the driver crashes due to a timeout. If I remove "pytest.mark.now", the driver can connect to the database without any issues.

Examples of errors in logs:

INFO RpcState(ListEndpoints, da910f59-4028-4d35-aeda-2d34a1c33590, localhost:46117): received error, <AioRpcError of RPC that terminated with:
	status = StatusCode.DEADLINE_EXCEEDED
	details = "Deadline Exceeded"
	debug_error_string = "UNKNOWN:Deadline Exceeded {created_time:"2025-01-14T18:32:40.4485154+03:00", grpc_status:4}"
>
DEBUG Failed to resolve endpoints for database /Root/local. Endpoint: "localhost:46117". Error details:
 Deadline exceeded on request

Expected behavior:

The driver connects to the database with and without "pytest.mark.now"

Steps to reproduce:

Related code:

import logging

import pytest
import ydb

logger = logging.getLogger(__name__)


@pytest.mark.now('2019-07-26T10:20:00+0000')
async def test_topic_creation(local_ydb):
    driver_config = ydb.DriverConfig(
        local_ydb.endpoint,
        local_ydb.database,
    )
    async with ydb.aio.Driver(driver_config) as driver:
        try:
            await driver.wait(timeout=10)
        except TimeoutError:
            logger.error('[YDB] Failed to connect to local YDB instance')
            logger.error('Last reported errors by discovery:')
            logger.error(driver.discovery_debug_details())
            raise
        topic_name = 'test_topic'
        await driver.topic_client.create_topic(topic_name)

Other information:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided async test, especially pytest.mark.now, the local_ydb fixture, and the await driver.wait(timeout=10) call. Compare driver discovery and timeout behavior with and without the marker, using the reported DEADLINE_EXCEEDED logs as a starting point. Done means the driver connects reliably in both cases and the test can create its topic.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.