-
Notifications
You must be signed in to change notification settings - Fork 0
ANDROID-16807 Add waitForCondition at loggerazzi logs comparation #11
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
Conversation
| compareFile.writeText(comparationResult.result!!) | ||
| throw AssertionError("Logs do not match:\n${comparationResult.result}") | ||
| } | ||
| recordedLogs = comparationResult.recordedLogs |
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.
Dump the latest logs obtained.
| val log = recordedLogs.joinToString("\n") { stringMapper.fromLog(it) } | ||
| val testFile = File(recordedDir, fileName) | ||
| testFile.createNewFile() | ||
| testFile.writeText(log) |
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.
Just moved
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.
Pull Request Overview
This PR adds a retry mechanism with timeout to the LoggerazziRule test comparison logic. Instead of immediately failing when logs don't match the golden file, the code now waits up to 5 seconds, checking every 500ms for the logs to eventually match the expected output.
Key changes:
- Refactored log comparison to use a polling mechanism with configurable timeout
- Introduced a
ComparationResultdata class to encapsulate comparison results - Added constants for polling interval (500ms) and timeout (5 seconds)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
nimeacuerdo
left a comment
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.
I would add this feature to the readme :)
-> d9e584e |
dnieto-r
left a comment
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.
LGTM! Just a couple of questions
ποΈ Jira ticket
ANDROID-16807
π₯ What's the goal?
Add some time after test ends to try to wait for logs to be the expected one, if after 5 seconds this still fails, test would be failed.
π§ How do we do it?
π Documentation changes?
π§ͺ How can I test this?