jamesfredley commented on code in PR #16553:
URL: https://github.com/apache/grails-core/pull/16553#discussion_r4214779088


##########
grails-forge/grails-forge-api/src/test/groovy/org/grails/forge/api/ApplicationControllerSpec.groovy:
##########
@@ -55,6 +58,16 @@ class ApplicationControllerSpec extends Specification {
         response.versions["grails.version"]
     }
 
+    void "test snapshot versions report end of support"() {
+        given:
+        def response = 
client.toBlocking().retrieve(HttpRequest.GET('/versions'), Map)
+
+        expect:
+        response.versions["grails.version"].endsWith('-SNAPSHOT')

Review Comment:
   This requires /versions to report a version ending in -SNAPSHOT. A release 
build correctly reports the release version, so the test fails for a correct 
response. Assert the returned version against the configured build version, and 
keep the end-of-support checks.



##########
grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/util/VersionInfoSpec.groovy:
##########
@@ -31,4 +40,50 @@ class VersionInfoSpec extends Specification {
         version.key == 'grails.version'
         version.value
     }
+
+    @Unroll
+    void "test version #version reports end of support"() {
+        given:
+        Class<?> versionInfo = loadVersionInfo(version, '2026-10-31')
+
+        expect:
+        versionInfo.getMethod('getEndOfSupport').invoke(null) == 
Optional.of(LocalDate.of(2026, 10, 31))
+        
!versionInfo.getMethod('getDependencyVersions').invoke(null).containsKey('grails.endOfSupport')
+        
versionInfo.getMethod('getDependencyVersions').invoke(null)['grails.version'] 
== version
+
+        where:
+        version << ['7.0.17', '7.0.18-SNAPSHOT']
+    }
+
+    @Unroll
+    void "test no end of support is reported for version #version and date 
#endOfSupport"() {
+        given:
+        Class<?> versionInfo = loadVersionInfo(version, endOfSupport)
+
+        expect:
+        versionInfo.getMethod('getEndOfSupport').invoke(null) == 
Optional.empty()
+        
!versionInfo.getMethod('getDependencyVersions').invoke(null).containsKey('grails.endOfSupport')
+
+        where:
+        version  | endOfSupport
+        '7.0.17' | null
+        '7.0.17' | '20207-07-31'
+    }
+
+    void "test the current snapshot build reports end of support"() {
+        expect:
+        VersionInfo.isGrailsSnapshot()

Review Comment:
   This asserts VersionInfo.isGrailsSnapshot() against the build that is 
running the test. On a release build, such as projectVersion=7.0.18, that 
returns false and :grails-forge-core:test fails. Release preparation replaces 
the snapshot version with the release version. Remove this assertion from the 
current-build test, and cover snapshot behavior with a fixture that sets the 
version.



-- 
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