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
Fix flaky test mavenRootPomHandlerBaseDirIsCorrect
#4452
Conversation
/retryBuild |
/retryBuilds |
mavenRootPomHandlerBaseDirIsCorrect
@@ -61,7 +61,7 @@ class JavaLambdaBuilderTest { | |||
} | |||
|
|||
@Test | |||
fun mavenRootPomHandlerBaseDirIsCorrect() = runTest { | |||
fun mavenRootPomHandlerBaseDirIsCorrect(): Unit = runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests should use runTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will revert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline, the issue is with runTest
and the fix is in a later version of coroutines-test
gradle/libs.versions.toml
Outdated
@@ -17,7 +17,7 @@ junit5 = "5.10.2" | |||
# https://kotlinlang.org/docs/releases.html#release-details | |||
kotlin = "1.9.23" | |||
# set in <root>/settings.gradle.kts | |||
kotlinCoroutines = "1.7.3" | |||
kotlinCoroutines = "1.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coroutines can't be safely bumped like this
https://github.com/aws/aws-toolkit-jetbrains/blob/main/kotlinResolution.settings.gradle.kts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@@ -61,7 +61,7 @@ class JavaLambdaBuilderTest { | |||
} | |||
|
|||
@Test | |||
fun mavenRootPomHandlerBaseDirIsCorrect() = runTest { | |||
fun mavenRootPomHandlerBaseDirIsCorrect(): Unit = runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would also be good to add a comment in the source code explaining why we're using runBlocking
fun mavenRootPomHandlerBaseDirIsCorrect(): Unit = runBlocking { | |
fun mavenRootPomHandlerBaseDirIsCorrect() = runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure Definitely, will add a comment.
mavenRootPomHandlerBaseDirIsCorrect()
method signature can't be removed its not taking Unit as default
Quality Gate passedIssues Measures |
Types of changes
Description
The test case mavenRootPomHandlerBaseDirIsCorrect() was updated to use
runBlocking
instead ofrunTest
.runBlocking
is a Kotlin coroutines function that helps bridge regular blocking code (code that stops the current thread)with coroutine based code (code that suspends execution and allows other tasks to run concurrently).
Using
runBlocking
resolved the issue with uncaught exceptions that was occurring when using the more specializedrunTest
function.Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.