Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: clear test state in any test case using SentryDependencyContainer #3378

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

armcknight
Copy link
Member

When looking at continued flakes of reachability tests, I noticed there are still dangling reachability observer instances when new test cases start (which I believe were coming from SentryHttpTransportTests). When I looked further I noticed that there were several tests that use SentryDependencyContainer, but never clean it up afterwards, so I added that call to each test suite's tearDown method.

Also changed one tearDown to tearDownWithError that did a manual XCTFail in a do/try/catch.

#skip-changelog

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #3378 (2822598) into main (3d8532d) will decrease coverage by 0.005%.
The diff coverage is 100.000%.

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #3378       +/-   ##
=============================================
- Coverage   89.335%   89.331%   -0.005%     
=============================================
  Files          500       500               
  Lines        54866     54862        -4     
  Branches     19676     19671        -5     
=============================================
- Hits         49015     49009        -6     
  Misses        4869      4869               
- Partials       982       984        +2     
Files Coverage Δ
...entryTests/Helper/SentryAppStateManagerTests.swift 100.000% <100.000%> (ø)
...ts/SentryTests/Helper/SentryFileManagerTests.swift 97.496% <100.000%> (+0.003%) ⬆️
Tests/SentryTests/Helper/SentryLogTests.swift 100.000% <ø> (ø)
...Tests/Integrations/ANR/SentryANRTrackerTests.swift 97.849% <100.000%> (+0.011%) ⬆️
...cking/SentryAppStartTrackingIntegrationTests.swift 91.578% <100.000%> (+0.089%) ⬆️
...racking/SentryFramesTrackingIntegrationTests.swift 98.648% <100.000%> (+0.018%) ⬆️
...tryTests/Networking/SentryHttpTransportTests.swift 97.691% <100.000%> (+0.002%) ⬆️
...sts/SentryTests/Protocol/SentryEnvelopeTests.swift 91.401% <100.000%> (+0.549%) ⬆️
Tests/SentryTests/SentryHubTests.swift 98.366% <100.000%> (+0.001%) ⬆️

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d8532d...2822598. Read the comment docs.

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @armcknight. LGTM.

@armcknight armcknight merged commit 282cc99 into main Nov 6, 2023
52 of 53 checks passed
@armcknight armcknight deleted the armcknight/ref/test-cleanup branch November 6, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants