ANDROID-16807 Add waitForCondition at loggerazzi logs comparation#11
Merged
ANDROID-16807 Add waitForCondition at loggerazzi logs comparation#11
Conversation
dpastor
commented
Sep 15, 2025
| compareFile.writeText(comparationResult.result!!) | ||
| throw AssertionError("Logs do not match:\n${comparationResult.result}") | ||
| } | ||
| recordedLogs = comparationResult.recordedLogs |
dpastor
commented
Sep 15, 2025
Comment on lines
+75
to
+78
| val log = recordedLogs.joinToString("\n") { stringMapper.fromLog(it) } | ||
| val testFile = File(recordedDir, fileName) | ||
| testFile.createNewFile() | ||
| testFile.writeText(log) |
Contributor
There was a problem hiding this comment.
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
approved these changes
Sep 17, 2025
Contributor
nimeacuerdo
left a comment
There was a problem hiding this comment.
I would add this feature to the readme :)
Author
-> d9e584e |
dnieto-r
approved these changes
Sep 17, 2025
loggerazzi/src/main/java/com/telefonica/loggerazzi/LoggerazziRule.kt
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎟️ 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?