Skip to content

DRAFT: Add support for the OCSP/CRL refresh wrapper REST API #411

DRAFT: Add support for the OCSP/CRL refresh wrapper REST API

DRAFT: Add support for the OCSP/CRL refresh wrapper REST API #411

GitHub Actions / JUnit report (local) failed Feb 9, 2024 in 0s

104 tests run, 43 passed, 1 skipped, 60 failed.

Annotations

Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_auth.test_valid_user_mtls

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def two_users(ginosession: None) -> Tuple[Person, Person]:
        """First one is normal, second is admin"""
        _ = ginosession
>       normal = await Person.create_with_cert("TestNormalUser")

tests/test_auth.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_auth.test_valid_user_jwt

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def two_users(ginosession: None) -> Tuple[Person, Person]:
        """First one is normal, second is admin"""
        _ = ginosession
>       normal = await Person.create_with_cert("TestNormalUser")

tests/test_auth.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_auth.test_valid_admin_mtls

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def two_users(ginosession: None) -> Tuple[Person, Person]:
        """First one is normal, second is admin"""
        _ = ginosession
>       normal = await Person.create_with_cert("TestNormalUser")

tests/test_auth.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_auth.test_valid_admin_jwt

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def two_users(ginosession: None) -> Tuple[Person, Person]:
        """First one is normal, second is admin"""
        _ = ginosession
>       normal = await Person.create_with_cert("TestNormalUser")

tests/test_auth.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 33 in .mypy_cache/3.11/tests/test_cfssl.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_cfssl.test_get_crl

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def one_revoked_cert(ginosession: None) -> None:
        """Make sure we have at least one revoked cert"""
        _ = ginosession
        # We have to make actual certs to be able to revoke them
>       person = await Person.create_with_cert(str(uuid.uuid4()))

tests/test_cfssl.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>
callsign = '7d9ec428-900c-4aa5-b017-f93987d34750', extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 33 in .mypy_cache/3.11/tests/test_cfssl.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_cfssl.test_crl_route

failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
  |     bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
  |     await refresh_ocsp()
  |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
  |     async with asyncio.TaskGroup() as tgr:
  |   File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
    |     async with session.post(url, data=send_payload, timeout=timeout) as response:
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
    |     self._resp = await self._coro
    |                  ^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
    |     await resp.start(conn)
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
    |     message, payload = await protocol.read()  # type: ignore[union-attr]
    |                        ^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
    |     await self._waiter
    | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
    |     await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
    |   File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
    |     raise CFSSLError(f"{url} raised {str(exc)}") from exc
    | rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
    +------------------------------------

The above exception was the direct cause of the following exception:

ginosession = None

    @pytest_asyncio.fixture(scope="session")
    async def one_revoked_cert(ginosession: None) -> None:
        """Make sure we have at least one revoked cert"""
        _ = ginosession
        # We have to make actual certs to be able to revoke them
>       person = await Person.create_with_cert(str(uuid.uuid4()))

tests/test_cfssl.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>
callsign = '7d9ec428-900c-4aa5-b017-f93987d34750', extra = None

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 70 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_person_crud

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <asyncpg.pool.Pool max=10 min=10 cur=9 use=0>
clause = <sqlalchemy.sql.dml.Insert object at 0x7f83e296d610>, multiparams = ()
params = {}, conn = <gino.engine.GinoConnection object at 0x7f83e296d710>

    async def first(self, clause, *multiparams, **params):
        """
        Runs :meth:`~.GinoConnection.first`, See :meth:`.all`.
    
        """
        async with self.acquire(reuse=True) as conn:
>           return await conn.first(clause, *multiparams, **params)

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1925: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:433: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-412' coro=<test_person_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:70> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:166: RuntimeError

During handling of the above exception, another exception occurred:

ginosession = None

    @pytest.mark.asyncio
    async def test_person_crud(ginosession: None) -> None:
        """Test the db abstraction of persons and roles"""
        _ = ginosession
        obj = Person(callsign="DOGGO01a", certspath=str(uuid.uuid4()))
>       await obj.create()

tests/test_db.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
    row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:219: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:209: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1500: in reset
    await self.execute(reset_query, timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:350: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:359: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:744: InterfaceError

Check failure on line 132 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_enrollments_crud

RuntimeError: Task <Task pending name='Task-414' coro=<test_enrollments_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:132> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_enrollments_crud(ginosession: None) -> None:
        """Test the db abstraction enrollments"""
        _ = ginosession
        # Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
        person = Person(callsign="MEGAMAN00a", certspath=str(uuid.uuid4()))
>       await person.create()

tests/test_db.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
    row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-414' coro=<test_enrollments_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:132> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 178 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_enrollmentpools_crud

RuntimeError: Task <Task pending name='Task-415' coro=<test_enrollmentpools_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:178> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_enrollmentpools_crud(ginosession: None) -> None:
        """Test the db abstraction enrollments and enrollmentpools"""
        _ = ginosession
        # Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
        person = Person(callsign="POOLBOYa", certspath=str(uuid.uuid4()))
>       await person.create()

tests/test_db.py:178: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
    row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-415' coro=<test_enrollmentpools_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:178> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 221 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_enrollmentpools_list

RuntimeError: Task <Task pending name='Task-416' coro=<test_enrollmentpools_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:221> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_enrollmentpools_list(ginosession: None) -> None:
        """Test list methods"""
        _ = ginosession
        # Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
        owner1 = Person(callsign="MASTER666a", certspath=str(uuid.uuid4()))
>       await owner1.create()

tests/test_db.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
    row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-416' coro=<test_enrollmentpools_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:221> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 254 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_enrollments_list

RuntimeError: Task <Task pending name='Task-417' coro=<test_enrollments_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:254> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_enrollments_list(ginosession: None) -> None:
        """Test list methods"""
        _ = ginosession
        # FIXME: should use fixtures instead of trusting on side effects from previous tests
        # Created in test_enrollmentpools_list
>       owner = await Person.by_callsign("MASTER666a")

tests/test_db.py:254: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/people.py:194: in by_callsign
    obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-417' coro=<test_enrollments_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:254> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 282 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_seentokens_crud

RuntimeError: Task <Task pending name='Task-418' coro=<test_seentokens_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:282> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_seentokens_crud(ginosession: None) -> None:
        """Test the db abstraction for seen tokens"""
        _ = ginosession
        token = str(uuid.uuid4())
        meta = {"koirat": "doggoi"}
        with pytest.raises(NotFound):
>           await SeenToken.by_token(token)

tests/test_db.py:282: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/nonces.py:40: in by_token
    obj = await SeenToken.query.where(SeenToken.token == token).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-418' coro=<test_seentokens_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:282> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 304 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_logincodes_crud

RuntimeError: Task <Task pending name='Task-419' coro=<test_logincodes_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:304> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_logincodes_crud(ginosession: None) -> None:
        """Test the db abstraction for login codes"""
        _ = ginosession
        await jwt_init()
>       code = await LoginCode.create_for_claims({"sub": "sotakoira"})

tests/test_db.py:304: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/logincodes.py:62: in create_for_claims
    await LoginCode.by_code(code)
src/rasenmaeher_api/db/logincodes.py:45: in by_code
    obj = await LoginCode.query.where(LoginCode.code == code).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-419' coro=<test_logincodes_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:304> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 327 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_person_with_cert

RuntimeError: Task <Task pending name='Task-420' coro=<test_person_with_cert() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:327> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_person_with_cert(ginosession: None) -> None:
        """Test the cert creation with the classmethod (and revocation)"""
        _ = ginosession
        await mtls_init()
>       person = await Person.create_with_cert("BINGO01a", {"kissa": "puuma"})

tests/test_db.py:327: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/people.py:60: in create_with_cert
    await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
    obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-420' coro=<test_person_with_cert() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:327> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 354 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_person_with_cert_cfsslfail

RuntimeError: Task <Task pending name='Task-421' coro=<test_person_with_cert_cfsslfail() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:354> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f83e15cd910>

    @pytest.mark.asyncio
    async def test_person_with_cert_cfsslfail(ginosession: None, monkeypatch: pytest.MonkeyPatch) -> None:
        """Test the cert creation with the classmethod with CFSSL failure"""
        _ = ginosession
        await mtls_init()
        peoplepath = Path(switchme_to_singleton_call.persistent_data_dir) / "private" / "people"
        old_files = set(peoplepath.rglob("*"))
        with monkeypatch.context() as mpatch:
            mpatch.setattr(switchme_to_singleton_call, "cfssl_host", "http://nosuchost")
            mpatch.setenv("RM_CFSSL_HOST", switchme_to_singleton_call.cfssl_host)
            with pytest.raises(BackendError):
>               await Person.create_with_cert("BONGO01a", {"kissa": "puuma"})

tests/test_db.py:354: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/people.py:60: in create_with_cert
    await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
    obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-421' coro=<test_person_with_cert_cfsslfail() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:354> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 368 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_person_with_cert_duplicatename

RuntimeError: Task <Task pending name='Task-422' coro=<test_person_with_cert_duplicatename() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:368> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_person_with_cert_duplicatename(ginosession: None) -> None:
        """Test the cert creation with the classmethod but reserved callsign"""
        _ = ginosession
        await mtls_init()
        callsign = "RUOSKA23a"
        peoplepath = Path(switchme_to_singleton_call.persistent_data_dir) / "private" / "people"
>       person = await Person.create_with_cert(callsign)

tests/test_db.py:368: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/people.py:60: in create_with_cert
    await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
    obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-422' coro=<test_person_with_cert_duplicatename() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:368> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 385 in .mypy_cache/3.11/tests/test_db.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_db.test_pfx_parse

RuntimeError: Task <Task pending name='Task-423' coro=<test_pfx_parse() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:385> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None

    @pytest.mark.asyncio
    async def test_pfx_parse(ginosession: None) -> None:
        """Test that the PFX file gets done"""
        _ = ginosession
        await mtls_init()
>       person = await Person.create_with_cert("PFXMAN01a")

tests/test_db.py:385: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/db/people.py:60: in create_with_cert
    await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
    obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
    con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-423' coro=<test_pfx_parse() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:385> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(50, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_show_verif_code[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_show_verifcode_bad_code[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_post_init[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_promote_demote[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_lock[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_accept[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError

Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_accept_no_such_user[tilauspalvelu_jwt_admin_client0]

failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
>                   certpem = (await sign_csr(csrpem)).replace("\\n", "\n")

src/rasenmaeher_api/db/people.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
    async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
    self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
    with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f83e1535e50>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f83e1535580>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError

The above exception was the direct cause of the following exception:

request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7f83e2935300>

    @functools.wraps(fixture)
    def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
    
        async def setup():
            res = await func(
                **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
            )
            return res
    
>       return event_loop.run_until_complete(setup())

../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
    res = await func(
tests/conftest.py:54: in test_user_secrets
    return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
    _anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}

    @classmethod
    async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
        """Create the cert etc and save the person"""
        cnf = RMSettings.singleton()
        if callsign in cnf.valid_product_cns:
            raise CallsignReserved("Using product CNs as callsigns is forbidden")
        try:
            await Person.by_callsign(callsign)
            raise CallsignReserved()
        except NotFound:
            pass
        async with db.acquire() as conn:
            async with conn.transaction():  # do it in a transaction so if something fails we can roll back
                puuid = uuid.uuid4()
                certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
                certspath.mkdir(parents=True)
                certspath.chmod(PRIVDIR_MODE)
                try:
                    newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
                    await newperson.create()
                    ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
                    csrpem = await async_create_client_csr(
                        ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
                    )
                    certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
                    bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
                    newperson.certfile.write_text(bundlepem)
                    await newperson.create_pfx()
                except Exception as exc:
                    LOGGER.exception("Something went wrong, doing cleanup")
                    shutil.rmtree(certspath)
                    remaining = list(certspath.rglob("*"))
                    LOGGER.debug("Remaining files: {}".format(remaining))
>                   raise BackendError(str(exc)) from exc
E                   rasenmaeher_api.db.errors.BackendError

src/rasenmaeher_api/db/people.py:86: BackendError