You are viewing a plain text version of this content. The canonical link for it is here.
Posted to geb-notifications@groovy.apache.org by jo...@apache.org on 2026/04/10 18:53:57 UTC
(groovy-geb) 15/31: fix codenarc violations.
This is an automated email from the ASF dual-hosted git repository.
jonnybot pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git
commit c7ddeac638b6e9dde4cf83c70f535df8e640956a
Author: Carl Marcum <ca...@codebuilders.net>
AuthorDate: Tue Feb 24 19:07:04 2026 -0500
fix codenarc violations.
---
.../groovy/grails/plugin/geb/WebDriverContainerHolder.groovy | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/integration/geb-testcontainers/src/main/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy b/integration/geb-testcontainers/src/main/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy
index e1b22f45..d7013715 100644
--- a/integration/geb-testcontainers/src/main/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy
+++ b/integration/geb-testcontainers/src/main/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy
@@ -78,6 +78,8 @@ class WebDriverContainerHolder {
private static final String HOST_PORT_PROPERTY = 'hostPort'
private static final String BASE_URL_PROPERTY = 'baseUrl'
private static final String DEFAULT_BROWSER = 'firefox'
+ private static final String CI_PROPERTY = 'CI'
+ private static final String LOCALHOST_IP = '127.0.0.1'
GrailsGebSettings settings
GebTestManager testManager
@@ -154,7 +156,7 @@ class WebDriverContainerHolder {
withEnv('SE_ENABLE_TRACING', settings.tracingEnabled.toString())
// Disable withAccessToHost when running in a container (CI environment)
// as SSH port forwarding doesn't work well in container-in-container setups
- if (!System.getenv('CI')) {
+ if (!System.getenv(CI_PROPERTY)) {
withAccessToHost(true)
} else {
// Increase startup timeout for CI environments (container-in-container is slower)
@@ -427,20 +429,20 @@ class WebDriverContainerHolder {
// In CI environments (container-in-container),
// withAccessToHost is disabled and PortForwardingContainer is not used.
// Get the actual IP address of this container so other containers can reach it.
- if (System.getenv('CI')) {
+ if (System.getenv(CI_PROPERTY)) {
try {
// Execute hostname -I to get the container's IP address
def process = 'hostname -I'.execute()
process.waitFor()
def ip = process.text.trim().split(/\s+/)[0]
- if (ip && ip != '127.0.0.1') {
+ if (ip && ip != LOCALHOST_IP) {
return ip
}
} catch (Exception e) {
log.warn('Failed to get container IP via hostname -I', e)
}
// Fallback to localhost
- return '127.0.0.1'
+ return LOCALHOST_IP
}
try {