Skip to content

chore: Fix auth integ test crashing when test fails #3077

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vincetran
Copy link
Member

@vincetran vincetran commented Jun 12, 2025

  • PR title and description conform to Pull Request guidelines.

Issue #, if available: N/A

Description of changes:

The JUnit framework captures only assertion errors in the main thread running the test. It is not aware of exceptions from within new spawn threads. In order to do it right, you should communicate the thread's termination state to the main thread. You should synchronize the threads correctly, and use some kind of shared variable to indicate the nested thread's outcome.

As such, by calling the JUnit fail() or assert*() methods from within any of the onSuccess/onFailure callbacks would end up crashing the integration test because those callbacks are ultimately called within a coroutine.

Used helper methods provided by Matt to refactor all of the integration tests to use them which also simplifies the test code overall so we don't need to actually use a latch anymore.

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Ensure commit message has the appropriate scope (e.g fix(storage): message, feat(auth): message, chore(all): message)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vincetran vincetran requested a review from a team as a code owner June 12, 2025 23:09
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.94%. Comparing base (ae14a5c) to head (d2ba2d6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3077      +/-   ##
==========================================
- Coverage   51.96%   51.94%   -0.02%     
==========================================
  Files        1033     1033              
  Lines       31335    31335              
  Branches     4537     4537              
==========================================
- Hits        16282    16277       -5     
- Misses      13366    13370       +4     
- Partials     1687     1688       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant