gemini-code-assist[bot] commented on code in PR #39290:
URL: https://github.com/apache/beam/pull/39290#discussion_r3561786816


##########
.test-infra/metrics/src/test/groovy/ProberTests.groovy:
##########
@@ -36,14 +36,14 @@ class ProberTests {
     def dashboardNames = allDashboards.title
     // Validate at least one expected dashboard exists
     assert dashboardNames.contains('Post-commit Test Reliability') : 'Expected 
dashboard does not exist'
-    assert dashboardNames.size > 0 : "No dashboards found. Check Grafana 
dashboard initialization script."
+    assert dashboardNames.size() > 0 : "No dashboards found. Check Grafana 
dashboard initialization script."
   }
 
   @Test
   void CheckGrafanaStalenessAlerts() {
     def alertsJson = 
"${grafanaEndpoint}/api/alerts?dashboardQuery=Source%20Data%20Freshness".toURL().text
     def alerts = new JsonSlurper().parseText(alertsJson)
-    assert alerts.size > 0
+    assert alerts.size() > 0

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   In Groovy, you can leverage "Groovy Truth" to check if a collection is 
non-null and non-empty. Using `assert alerts` is more idiomatic and safer as it 
avoids potential `NullPointerException` if `alerts` is null, throwing a clear 
`AssertionError` instead.
   
   ```
       assert alerts
   ```



##########
.test-infra/metrics/src/test/groovy/ProberTests.groovy:
##########
@@ -36,14 +36,14 @@ class ProberTests {
     def dashboardNames = allDashboards.title
     // Validate at least one expected dashboard exists
     assert dashboardNames.contains('Post-commit Test Reliability') : 'Expected 
dashboard does not exist'
-    assert dashboardNames.size > 0 : "No dashboards found. Check Grafana 
dashboard initialization script."
+    assert dashboardNames.size() > 0 : "No dashboards found. Check Grafana 
dashboard initialization script."

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   In Groovy, you can leverage "Groovy Truth" to check if a collection is 
non-null and non-empty. Using `assert dashboardNames` is more idiomatic and 
safer as it avoids potential `NullPointerException` if the collection is null, 
throwing a clear `AssertionError` instead.
   
   ```
       assert dashboardNames : "No dashboards found. Check Grafana dashboard 
initialization script."
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to