Skip to content

Commit 9c77cf5

Browse files
authored
ci: fix version parsing for calver (#799)
Now that the CI config is fixed and runs against calver, we need to update the version parsing logic accordingly.
1 parent 07f37d0 commit 9c77cf5

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

test-support/src/main/scala/org/neo4j/spark/TestUtil.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ object Version {
3333

3434
def parse(version: String): Version = {
3535
val fields = version.split("\\.")
36+
.map(field => {
37+
val additionalInfoIndex = field.indexOf('-')
38+
if (additionalInfoIndex.equals(-1)) field
39+
else field.substring(0, additionalInfoIndex)
40+
})
3641
.map(_.toInt)
3742
.toList
3843

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [https://neo4j.com]
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.neo4j.spark
18+
19+
import org.junit.Assert.assertEquals
20+
import org.junit.Test
21+
22+
class VersionTest {
23+
24+
@Test
25+
def parses_versions(): Unit = {
26+
assertEquals(Version(5, 26, 399), Version.parse("5.26.399"))
27+
assertEquals(Version(2025, 11, 0), Version.parse("2025.11.0-41865"))
28+
}
29+
}

0 commit comments

Comments
 (0)