Skip to content

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

Merged
Jan-Kazlouski-elastic merged 1 commit into
9.4from
backport/9.4/pr-4455
Sep 9, 2026
Merged

Jan-Kazlouski-elastic merged 1 commit into
9.4from
backport/9.4/pr-4455

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Backports the following commits to 9.4:

<!--Provide a general description of the code changes in your pull
request.
If the change relates to a specific issue, include the link at the top.

If this is an ad-hoc/trivial change and does not have a corresponding
issue, please describe your changes in enough details, so that reviewers
and other team members can understand the reasoning behind the pull
request.-->

Several unit tests passed assertions but intermittently failed CI under
the default 1s `pytest-fail-slow` threshold because they still hit real
I/O:

- Oracle/MSSQL tests patched `Engine.connect` but still called real
`create_engine`
- GraphQL `close()` accessed the cached `session` property, creating an
`aiohttp.ClientSession` even when none was used
- Some GitLab `get_docs` integration tests left `get_work_items_group`
unmocked, triggering real HTTP for epic fetches

This PR mocks `create_engine` via a shared test helper, guards GraphQL
session teardown, stubs epic fetches where not under test, and adds a
regression test for GraphQL close behavior.

## Checklists

<!--You can remove unrelated items from checklists below and/or add new
items that may help during the review.-->

#### Pre-Review Checklist
- [x] this PR does NOT contain credentials of any kind, such as API keys
or username/passwords (double check `config.yml.example`)
- [x] this PR has a meaningful title
- [ ] this PR links to all relevant github issues that it fixes or
partially addresses
- [x] if there is no GH issue, please create it. Each PR should have a
link to an issue
- [x] this PR has a thorough description
- [x] Covered the changes with automated tests
- [x] Tested the changes locally
- [x] Added a label for each target release version (example: `v7.13.2`,
`v7.14.0`, `v8.0.0`)
- [ ] For bugfixes: backport safely to all minor branches still
receiving patch releases
- [ ] Considered corresponding documentation changes
- [ ] Contributed any configuration settings changes to the
configuration reference
- [ ] if you added or changed Rich Configurable Fields for a Native
Connector, you made a corresponding PR in
[Kibana](https://github.com/elastic/kibana/blob/main/packages/kbn-search-connectors/types/native_connectors.ts)

#### Changes Requiring Extra Attention

<!--Please call out any changes that require special attention from the
reviewers and/or increase the risk to availability or security of the
system after deployment. Remove the ones that don't apply.-->

## Related Pull Requests

* #4184
* #4442

## Release Note

<!--If you think this enhancement/fix should be included in the release
notes,
please write a concise user-facing description of the change here.
You should also label the PR with `release_note` so the release notes
author(s) can easily look it up.-->
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit 3ee8642 into 9.4 Sep 9, 2026
2 checks passed
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic deleted the backport/9.4/pr-4455 branch September 9, 2026 14:14
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