Skip to content

[8.19] test: mock real I/O in unit tests to stop fail-slow flakes (#4455) - #4468

Merged
Jan-Kazlouski-elastic merged 2 commits into
8.19from
backport/8.19/pr-4455
Sep 9, 2026
Merged

Jan-Kazlouski-elastic merged 2 commits into
8.19from
backport/8.19/pr-4455

Conversation

@Jan-Kazlouski-elastic

Copy link
Copy Markdown
Contributor

Backports #4455 to 8.19.

Summary

  • Add shared mock_sync_db_engine helper and use it in Oracle/MSSQL tests instead of only patching Engine.connect.
  • Mock aiohttp.ClientSession in the GraphQL test helper so teardown does not open a real session.
  • Add regression test asserting GraphQL teardown does not instantiate a real ClientSession.

Backport notes

  • The 8.19 branch uses monolithic connectors/sources/{graphql,mssql,oracle}.py modules, so patch targets differ from main (connectors.sources.graphql.aiohttp.ClientSession, connectors.sources.mssql.create_engine, etc.).
  • GitLab get_work_items_group stubs from the original PR are not applicable on 8.19 (method does not exist there).
  • The incidental NOTICE.txt version bump from make install is intentionally excluded.

Test plan

  • make clean install autoformat lint test
  • pytest tests/sources/test_graphql.py tests/sources/test_mssql.py tests/sources/test_oracle.py

)

Backports #4455 to `8.19`.

## Summary
- Add shared `mock_sync_db_engine` helper and use it in Oracle/MSSQL tests instead of only patching `Engine.connect`.
- Mock `aiohttp.ClientSession` in the GraphQL test helper so teardown does not open a real session.
- Add regression test asserting GraphQL teardown does not instantiate a real `ClientSession`.

## Backport notes
- The 8.19 branch uses monolithic `connectors/sources/{graphql,mssql,oracle}.py` modules, so patch targets differ from `main` (`connectors.sources.graphql.aiohttp.ClientSession`, `connectors.sources.mssql.create_engine`, etc.).
- GitLab `get_work_items_group` stubs from the original PR are not applicable on 8.19 (method does not exist there).
- The incidental `NOTICE.txt` version bump from `make install` is intentionally excluded.

## Test plan
- [x] `make clean install autoformat lint test`
- [x] `pytest tests/sources/test_graphql.py tests/sources/test_mssql.py tests/sources/test_oracle.py`
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit 992038c into 8.19 Sep 9, 2026
2 checks passed
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic deleted the backport/8.19/pr-4455 branch September 9, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants