Skip to content

Conversation

@dpastor
Copy link
Contributor

@dpastor dpastor commented Sep 15, 2025

🎟️ 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?

  • Just add a waiting mechanism for logs comparation

πŸ“˜ Documentation changes?

  • No docs to update nor create

πŸ§ͺ How can I test this?

  • Run instrumentation tests inside repository

@dpastor dpastor requested review from a team, Copilot, dnieto-r and hjorrod and removed request for a team September 15, 2025 16:30
compareFile.writeText(comparationResult.result!!)
throw AssertionError("Logs do not match:\n${comparationResult.result}")
}
recordedLogs = comparationResult.recordedLogs
Copy link
Contributor Author

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.

Comment on lines +75 to +78
val log = recordedLogs.joinToString("\n") { stringMapper.fromLog(it) }
val testFile = File(recordedDir, fileName)
testFile.createNewFile()
testFile.writeText(log)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just moved

Copy link
Contributor

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.

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 ComparationResult data 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.

Copy link
Contributor

@nimeacuerdo nimeacuerdo left a 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 :)

@dpastor
Copy link
Contributor Author

dpastor commented Sep 17, 2025

I would add this feature to the readme :)

-> d9e584e

Copy link

@dnieto-r dnieto-r left a 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

@dpastor dpastor merged commit fdc8370 into main Sep 17, 2025
1 check passed
@dpastor dpastor deleted the wait_for_logs branch September 17, 2025 09:11
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.

4 participants