Ensure MySQL tests cleanup connections and raise an exception if they do not (#87767)

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
J. Nick Koston 2023-02-09 16:27:53 -06:00 committed by GitHub
parent 84d14cc76a
commit cbaf4764e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -130,6 +130,10 @@ async def test_shutdown_before_startup_finishes(
assert run_info.run_id == 1
assert run_info.start is not None
assert run_info.end is not None
# We patched out engine to prevent the close from happening
# so we need to manually close the session
session.close()
await hass.async_add_executor_job(instance._shutdown)
async def test_canceled_before_startup_finishes(
@ -152,6 +156,9 @@ async def test_canceled_before_startup_finishes(
"Recorder startup was externally canceled before it could complete"
in caplog.text
)
# We patched out engine to prevent the close from happening
# so we need to manually close the session
await hass.async_add_executor_job(instance._shutdown)
async def test_shutdown_closes_connections(recorder_mock, hass):