This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 06645cd674 test additional user agent workarounds
06645cd674 is described below

commit 06645cd674262ec1b8e4ab691bac13835ffcecb3
Author: Paul King <[email protected]>
AuthorDate: Mon May 11 18:00:01 2026 +1000

    test additional user agent workarounds
---
 .../java/groovy/junit6/plugin/ForkedJvmExtension.java     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/subprojects/groovy-test-junit6/src/main/java/groovy/junit6/plugin/ForkedJvmExtension.java
 
b/subprojects/groovy-test-junit6/src/main/java/groovy/junit6/plugin/ForkedJvmExtension.java
index 9c0921cf2c..ef879c1e2c 100644
--- 
a/subprojects/groovy-test-junit6/src/main/java/groovy/junit6/plugin/ForkedJvmExtension.java
+++ 
b/subprojects/groovy-test-junit6/src/main/java/groovy/junit6/plugin/ForkedJvmExtension.java
@@ -121,6 +121,21 @@ public class ForkedJvmExtension implements 
InvocationInterceptor {
         if (parentInverting) {
             cmd.add("-D" + ExpectedToFailExtension.DEFERRED_TO_PARENT_PROP + 
"=true");
         }
+        // Always-inherited properties: things whose absence in the child JVM
+        // would cause confusing failures that don't reflect the test's intent.
+        // - http.agent: parent's User-Agent override (see 
org.apache.groovy-tested.gradle's
+        //   GROOVY-12005 comment). Maven Central's Cloudflare WAF returns 
HTTP 404
+        //   for requests bearing the JDK default "Java/<version>" agent; if a 
child
+        //   JVM doing @Grab inherits the parent's UA it stays consistent with 
the
+        //   parent test JVM's behaviour. Test authors can still override 
per-fork
+        //   via systemProperties=[] on @ForkedJvm — explicit entries land 
later on
+        //   the command line and win.
+        for (String name : new String[]{"http.agent"}) {
+            String value = System.getProperty(name);
+            if (value != null) {
+                cmd.add("-D" + name + "=" + value);
+            }
+        }
         // Inherited properties first, then explicit systemProperties — later 
-D wins on the JVM command line.
         for (String name : resolveInherited(config.inheritProperties())) {
             cmd.add("-D" + name + "=" + System.getProperty(name));

Reply via email to