GoogleCloudPlatform / cloud-sql-python-connector

A Python library for connecting securely to your Cloud SQL instances.
Apache License 2.0
278 stars 65 forks source link

system.test_asyncpg_connection: test_connection_with_asyncpg failed #839

Closed flaky-bot[bot] closed 12 months ago

flaky-bot[bot] commented 12 months ago

Note: #661 was also for this test, but it was closed more than 10 days ago. So, I didn't mark it flaky.


commit: 9a57a41a76c4c7d2fcf94bfbbb54e5575802dc57 buildURL: https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/runs/6122618453 status: failed

Test output
@pytest.fixture(name="pool")
    async def setup() -> AsyncGenerator:
        pool = await init_connection_pool()
>       async with pool.connect() as conn:

tests\system\test_asyncpg_connection.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox\system-3-11\Lib\site-packages\sqlalchemy\ext\asyncio\base.py:127: in __aenter__
    return await self.start(is_ctxmanager=True)  # type: ignore
.nox\system-3-11\Lib\site-packages\sqlalchemy\ext\asyncio\engine.py:268: in start
    await greenlet_spawn(self.sync_engine.connect)
.nox\system-3-11\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py:190: in greenlet_spawn
    result = context.throw(*sys.exc_info())
.nox\system-3-11\Lib\site-packages\sqlalchemy\engine\base.py:3264: in connect
    return self._connection_cls(self)
.nox\system-3-11\Lib\site-packages\sqlalchemy\engine\base.py:145: in __init__
    self._dbapi_connection = engine.raw_connection()
.nox\system-3-11\Lib\site-packages\sqlalchemy\engine\base.py:3288: in raw_connection
    return self.pool.connect()
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:452: in connect
    return _ConnectionFairy._checkout(self)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:1267: in _checkout
    fairy = _ConnectionRecord.checkout(pool)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:716: in checkout
    rec = pool._do_get()
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\impl.py:169: in _do_get
    with util.safe_reraise():
.nox\system-3-11\Lib\site-packages\sqlalchemy\util\langhelpers.py:147: in __exit__
    raise exc_value.with_traceback(exc_tb)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\impl.py:167: in _do_get
    return self._create_connection()
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:393: in _create_connection
    return _ConnectionRecord(self)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:678: in __init__
    self.__connect()
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:902: in __connect
    with util.safe_reraise():
.nox\system-3-11\Lib\site-packages\sqlalchemy\util\langhelpers.py:147: in __exit__
    raise exc_value.with_traceback(exc_tb)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:898: in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
.nox\system-3-11\Lib\site-packages\sqlalchemy\pool\base.py:365: in 
    return lambda rec: creator_fn()
.nox\system-3-11\Lib\site-packages\sqlalchemy\ext\asyncio\engine.py:112: in creator
    return sync_engine.dialect.dbapi.connect(  # type: ignore
.nox\system-3-11\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py:917: in connect
    await_only(creator_fn(*arg, **kw)),
.nox\system-3-11\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py:125: in await_only
    return current.driver.switch(awaitable)  # type: ignore[no-any-return]
.nox\system-3-11\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py:185: in greenlet_spawn
    value = await result
tests\system\test_asyncpg_connection.py:38: in getconn
    conn: asyncpg.Connection = await connector.connect_async(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

task = )>

    async def _is_valid(task: asyncio.Task) -> bool:
        try:
>           metadata = await task
E           aiohttp.client_exceptions.ClientResponseError: 502, message='Bad Gateway', url=URL('https://sqladmin.googleapis.com/sql/v1beta4/projects/cloud-sql-connector-testing/instances/postgres-proxy-testing:generateEphemeralCert')

google\cloud\sql\connector\refresh_utils.py:238: ClientResponseError
flaky-bot[bot] commented 12 months ago

Looks like this issue is flaky. :worried:

I'm going to leave this open and stop commenting.

A human should fix and close this.


When run at the same commit (9a57a41a76c4c7d2fcf94bfbbb54e5575802dc57), this test passed in one build (https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/runs/6122618453) and failed in another build (https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/actions/runs/6122618453).

jackwotherspoon commented 12 months ago

Too many dep PRs at once