Liveness check with updated dependencies#1429
Liveness check with updated dependencies#1429gayaldassanayake merged 16 commits intoballerina-platform:masterfrom
Conversation
📝 WalkthroughWalkthroughBumps package and native/plugin artifact versions to 1.16.2, updates several stdlib and Ballerinax dependency versions (adds Avro/Kafka/Confluent), changes CdcListener config type to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ballerina/Ballerina.toml`:
- Around line 18-19: The version and JAR path are inconsistent: the version key
"version" is set to "1.16.2" while the path references
"mysql-native-1.16.2-SNAPSHOT.jar"; update either the version field to
"1.16.2-SNAPSHOT" or change the path to point to "mysql-native-1.16.2.jar" so
the "version" value and the JAR filename in the "path" string match; ensure you
update the "version" key and/or the path literal accordingly to reflect whether
this is a snapshot or a release.
🧹 Nitpick comments (1)
ballerina/tests/listener_liveness_test.bal (1)
24-38: Missing cleanup for attached service.The test attaches
testServicetomysqlListenerbut never detaches or stops the listener. While the listener isn't started, consider adding cleanup for consistency and to avoid potential resource leaks in the test environment.♻️ Suggested cleanup
function testLivenessBeforeListenerStart() returns error? { CdcListener mysqlListener = new ({ database: { username: cdcUsername, password: cdcPassword, port }, options: { snapshotMode: cdc:NO_DATA } }); check mysqlListener.attach(testService); boolean liveness = check cdc:isLive(mysqlListener); test:assertFalse(liveness, "Liveness check passes even before listener starts"); + check mysqlListener.detach(testService); }
| version = "1.16.2" | ||
| path = "../native/build/libs/mysql-native-1.16.2-SNAPSHOT.jar" |
There was a problem hiding this comment.
Version mismatch between declared version and JAR path.
The version field is "1.16.2" but the path references mysql-native-1.16.2-SNAPSHOT.jar. This inconsistency could cause confusion during dependency resolution or release processes.
Consider aligning these values:
- If this is a snapshot/development build, update version to
"1.16.2-SNAPSHOT" - If this is a release, ensure the path references the non-SNAPSHOT JAR
🤖 Prompt for AI Agents
In `@ballerina/Ballerina.toml` around lines 18 - 19, The version and JAR path are
inconsistent: the version key "version" is set to "1.16.2" while the path
references "mysql-native-1.16.2-SNAPSHOT.jar"; update either the version field
to "1.16.2-SNAPSHOT" or change the path to point to "mysql-native-1.16.2.jar" so
the "version" value and the JAR filename in the "path" string match; ensure you
update the "version" key and/or the path literal accordingly to reflect whether
this is a snapshot or a release.
ae3aa6e to
6c0744e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (74.51%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1429 +/- ##
============================================
+ Coverage 74.43% 74.51% +0.07%
Complexity 125 125
============================================
Files 27 27
Lines 669 671 +2
Branches 128 128
============================================
+ Hits 498 500 +2
Misses 122 122
Partials 49 49 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ballerina/tests/listener_liveness_test.bal`:
- Around line 25-33: The database port field in the CdcListener initializer is
using an undefined shorthand `port`; update the `CdcListener mysqlListener = new
({ ... })` database config to use the explicit field `port: cdcPort` (replace
the `port` shorthand) so the `database` map compiles and matches other tests'
usage of `cdcPort`.
---
Duplicate comments:
In `@ballerina/Ballerina.toml`:
- Around line 18-19: The TOML file has a mismatch between the version key and
the referenced JAR: the version = "1.16.2" field must match the JAR name in the
path value; either update the version key to "1.16.2-SNAPSHOT" to match
mysql-native-1.16.2-SNAPSHOT.jar or change the path to point to a non‑SNAPSHOT
JAR (e.g., mysql-native-1.16.2.jar). Edit the version and/or path entries (the
version field and the path value) so they are consistent.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
ballerina/tests/listener_liveness_test.bal (2)
24-34: Reduce repeated listener setup.The same
database+optionsconfiguration is duplicated across all four tests. Consider extracting a small helper to construct the listener config so future changes stay consistent across the suite.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ballerina/tests/listener_liveness_test.bal` around lines 24 - 34, Multiple tests duplicate the same CdcListener configuration (the database and options blocks used when constructing CdcListener in testLivenessBeforeListenerStart and the other three tests); factor this into a small helper such as a function (e.g., newTestListenerConfig or createCdcListener) that returns the configuration record or directly constructs and returns a CdcListener instance so all tests call that helper instead of repeating the database: { username: cdcUsername, password: cdcPassword, port: cdcPort } and options: { snapshotMode: cdc:NO_DATA } blocks; update testLivenessBeforeListenerStart and the other tests to use the helper (referencing CdcListener and cdc:NO_DATA) to keep configuration centralized and consistent.
98-101: Consider polling instead of a fixed 10‑second wait.The hard-coded wait makes the test slower and can still be flaky. A short-interval poll with a timeout usually gives the same coverage with less runtime.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ballerina/tests/listener_liveness_test.bal` around lines 98 - 101, Replace the fixed runtime:sleep(10) with a short-interval polling loop that repeatedly calls cdc:isLive(mysqlListener) until either it returns false or a small timeout elapses; use a small poll interval (e.g., 100–200ms) to reduce test runtime and flakiness, and then assertFalse on the final liveness result (keep using mysqlListener, cdc:isLive, and test:assertFalse) so the test fails if liveness remains true after the timeout.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ballerina/tests/listener_liveness_test.bal`:
- Around line 24-34: Multiple tests duplicate the same CdcListener configuration
(the database and options blocks used when constructing CdcListener in
testLivenessBeforeListenerStart and the other three tests); factor this into a
small helper such as a function (e.g., newTestListenerConfig or
createCdcListener) that returns the configuration record or directly constructs
and returns a CdcListener instance so all tests call that helper instead of
repeating the database: { username: cdcUsername, password: cdcPassword, port:
cdcPort } and options: { snapshotMode: cdc:NO_DATA } blocks; update
testLivenessBeforeListenerStart and the other tests to use the helper
(referencing CdcListener and cdc:NO_DATA) to keep configuration centralized and
consistent.
- Around line 98-101: Replace the fixed runtime:sleep(10) with a short-interval
polling loop that repeatedly calls cdc:isLive(mysqlListener) until either it
returns false or a small timeout elapses; use a small poll interval (e.g.,
100–200ms) to reduce test runtime and flakiness, and then assertFalse on the
final liveness result (keep using mysqlListener, cdc:isLive, and
test:assertFalse) so the test fails if liveness remains true after the timeout.
7e4c506
into
ballerina-platform:master
Purpose
Fixes:
Examples
Checklist
Summary
This pull request updates the MySQL module to improve CDC listener liveness handling and synchronizes several dependency and build artifact versions.
Key changes
Module and artifacts
Dependencies and build
Functional changes
Tests
Impact