You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/10/11 15:01:31 UTC

(grails-core) branch fix/startup-progress-stale-opened-file created (now 3b5803f22e)

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

borinquenkid pushed a change to branch fix/startup-progress-stale-opened-file
in repository https://gitbox.apache.org/repos/asf/grails-core.git


      at 3b5803f22e fix(startup-progress): clear recorded browser launches before each feature

This branch includes the following new commits:

     new 3b5803f22e fix(startup-progress): clear recorded browser launches before each feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(grails-core) 01/01: fix(startup-progress): clear recorded browser launches before each feature

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch fix/startup-progress-stale-opened-file
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 3b5803f22e562becca4c36efdcfe064007684ca2
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Sun Oct 11 10:00:36 2026 -0500

    fix(startup-progress): clear recorded browser launches before each feature
    
    The shared browser directory kept opened-<port>.txt files across features,
    and freePort() can hand the same port to a later feature, so 'does not open
    a browser unless asked to' could see an earlier feature's launch.
    
    Co-Authored-By: Claude Sonnet 5.5 <no...@anthropic.com>
---
 .../org/apache/grails/startup/StartupProgressSpec.groovy   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/grails-startup-progress/src/test/groovy/org/apache/grails/startup/StartupProgressSpec.groovy b/grails-startup-progress/src/test/groovy/org/apache/grails/startup/StartupProgressSpec.groovy
index 35b92ae96e..a1af3901c6 100644
--- a/grails-startup-progress/src/test/groovy/org/apache/grails/startup/StartupProgressSpec.groovy
+++ b/grails-startup-progress/src/test/groovy/org/apache/grails/startup/StartupProgressSpec.groovy
@@ -125,6 +125,7 @@ class StartupProgressSpec extends Specification {
 
     void setup() {
         port = freePort()
+        browserDir.listFiles({ File file -> file.name.startsWith('opened-') } as FileFilter)*.delete()
         Gates.reset(port)
         standardError = System.err
         System.setErr(new PrintStream(new Tee(standardError, log), true, 'UTF-8'))
@@ -679,6 +680,19 @@ class StartupProgressSpec extends Specification {
         !opened.exists()
     }
 
+    void 'records a browser launch that a later feature must not see'() {
+        when: 'a feature opens a browser, as the ones that ask for it do, on a port a later feature may be given too'
+        new File(browserDir, "opened-${port}.txt").text = "http://localhost:${port}/\n"
+
+        then:
+        new File(browserDir, "opened-${port}.txt").exists()
+    }
+
+    void 'starts each feature with no browser launch recorded by an earlier one'() {
+        expect: 'the port may repeat across features, so a stale record would pass for this feature opening a browser'
+        browserDir.list().findAll { String name -> name.startsWith('opened-') }.isEmpty()
+    }
+
     void 'serves a report of the start, as a page or as data, for as long as the application runs'() {
         given: 'a bean that takes its time to create'
         Gates.beanCreation = new CountDownLatch(1)