-
Notifications
You must be signed in to change notification settings - Fork 93
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 tests #7223
Fix flaky tests #7223
Conversation
cb4e91e
to
2fd52cd
Compare
updated: #7245 |
2fd52cd
to
21bad8d
Compare
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request includes modifications to two primary files: In In Sequence Diagram(s)sequenceDiagram
participant User
participant PeriodicProcessService
participant KafkaClient
User->>PeriodicProcessService: Trigger deployment
PeriodicProcessService->>KafkaClient: Create topic
KafkaClient->>KafkaClient: Await topic availability
KafkaClient-->>PeriodicProcessService: Topic created
PeriodicProcessService->>User: Deployment completed
sequenceDiagram
participant User
participant PeriodicProcessService
User->>PeriodicProcessService: Trigger schedule
PeriodicProcessService->>PeriodicProcessService: Wait for previous schedule to finish
PeriodicProcessService-->>User: Schedule deployed
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
utils/kafka-test-utils/src/main/scala/pl/touk/nussknacker/engine/kafka/KafkaClient.scala (1)
35-42
: LGTM: Implementation effectively addresses flaky testsThe blocking implementation with retry logic is a good solution for ensuring topic availability in test environments. The 10-second timeout with 1-second retry intervals provides a good balance between reliability and test execution time.
Consider these minor improvements:
val maxTime = 10.seconds Await.result( retry.Pause(10, 1.second)(Timer.default)( Future { - topic(name) + topic(name).getOrElse(throw new RuntimeException(s"Topic $name not available after creation")) } ), maxTime )This would provide a more descriptive error message if the topic creation fails.
engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala (1)
Line range hint
432-450
: Consider enhancing the eventually block with timeout configurationThe use of
eventually
block is a good solution for handling async operations and fixing flaky tests. However, consider adding explicit timeout and interval configurations to make the test behavior more predictable and failures more descriptive.Consider enhancing the eventually block like this:
val firstActivity = eventually { + implicit val patienceConfig = PatienceConfig( + timeout = Span(10, Seconds), + interval = Span(100, Millis) + ) val result = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue result should not be empty result.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - } + }(PatienceConfiguration.Timeout(10.seconds), PatienceConfiguration.Interval(100.milliseconds))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala
(3 hunks)utils/kafka-test-utils/src/main/scala/pl/touk/nussknacker/engine/kafka/KafkaClient.scala
(2 hunks)
🔇 Additional comments (2)
utils/kafka-test-utils/src/main/scala/pl/touk/nussknacker/engine/kafka/KafkaClient.scala (1)
15-15
: LGTM: Import addition is appropriate
The addition of Await
to the concurrent imports is necessary for the blocking implementation in createTopic
.
engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala (1)
16-16
: LGTM! Good addition for async testing
The import of timing-related classes is appropriate for configuring eventual consistency checks in async tests.
Describe your changes
Checklist before merge
Summary by CodeRabbit
Bug Fixes
Refactor
Chores