Skip to content

dataconnect: fix flaky test that ensures deserialize() throws IllegalArgumentException on invalid input #6839

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

Merged
merged 2 commits into from
Apr 4, 2025

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Apr 4, 2025

Fix unparseableDash() in LocalDateSerializerUnitTest.kt to not include numbers in the set of "invalid" characters because they become "valid" when adjacent to other numeric digits. In certain situations, using a "digit" as an invalid character was causing flaky test failures such as this one in deserialize() should throw IllegalArgumentException when given unparseable strings:

Arg 0: "96-082895-312"

Repeat this test by using seed -7108070269336260794

Caused by: Expected exception java.lang.IllegalArgumentException but no exception was thrown.
	at com.google.firebase.dataconnect.serializers.LocalDateSerializerUnitTest$deserialize() should throw IllegalArgumentException when given unparseable strings$1.invokeSuspend(LocalDateSerializerUnitTest.kt:104)
	at com.google.firebase.dataconnect.serializers.LocalDateSerializerUnitTest$deserialize() should throw IllegalArgumentException when given unparseable strings$1.invoke(LocalDateSerializerUnitTest.kt)
	at com.google.firebase.dataconnect.serializers.LocalDateSerializerUnitTest$deserialize() should throw IllegalArgumentException when given unparseable strings$1.invoke(LocalDateSerializerUnitTest.kt)

Note that the string "96-082895-312" is 3 valid numbers separated by dashes and, therefore, is successfully parsed as a date. The "-0" was the string produced by unparseableDash() which, when combined with the rest of the string, did not, in fact, produce an unparseable dash.

…numbers as "invalid" characters because they become "valid" when adjacent to other numeric digits.
Copy link
Contributor

github-actions bot commented Apr 4, 2025

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

2 similar comments
Copy link
Contributor

github-actions bot commented Apr 4, 2025

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

Copy link
Contributor

github-actions bot commented Apr 4, 2025

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@google-oss-bot
Copy link
Contributor

Copy link
Contributor

github-actions bot commented Apr 4, 2025

Test Results

   66 files   -    968     66 suites   - 968   1m 11s ⏱️ - 33m 8s
  552 tests  -  5 320    551 ✅  -  5 299  1 💤  - 21  0 ❌ ±0 
1 104 runs   - 10 703  1 102 ✅  - 10 661  2 💤  - 42  0 ❌ ±0 

Results for commit 7a500d1. ± Comparison against base commit a0a02a7.

This pull request removes 5320 tests.
com.google.android.datatransport.cct.CctBackendFactoryTest ‑ create_returnCCTBackend_WhenBackendNameIsCCT
com.google.android.datatransport.cct.CctDestinationTest ‑ cctDestination_shouldOnlySupportProtoAndJson
com.google.android.datatransport.cct.CctDestinationTest ‑ cctDestination_shouldSupportProtoAndJson
com.google.android.datatransport.cct.CctTransportBackendTest ‑ decorate_whenOffline_shouldProperlyPopulateNetworkInfo
com.google.android.datatransport.cct.CctTransportBackendTest ‑ decorate_whenOnline_shouldProperlyPopulateNetworkInfo
com.google.android.datatransport.cct.CctTransportBackendTest ‑ schedule_shouldAddCookieOnPseudonymousIds
com.google.android.datatransport.cct.CctTransportBackendTest ‑ schedule_shouldDropCookieOnMixedPseudonymousIds
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_CompressedResponseIsUncompressed
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_whenBackendRedirectsMoreThan5Times_shouldOnlyRedirect4Times
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_whenBackendRedirects_shouldCorrectlyFollowTheRedirectViaPost
…

@google-oss-bot
Copy link
Contributor

@dconeybe dconeybe marked this pull request as ready for review April 4, 2025 19:17
@dconeybe dconeybe requested a review from Copilot April 4, 2025 19:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@dconeybe dconeybe merged commit 8af38c9 into main Apr 4, 2025
43 of 44 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/UnparseableDashFix branch April 4, 2025 19:49
@firebase firebase locked and limited conversation to collaborators May 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants