Skip to content

Commit 1504473

Browse files
authored
W-12334626: run old test suites using language level for regression t… (#70)
* W-12334626: run old test suites using language level for regression testing
1 parent 1615ceb commit 1504473

5 files changed

Lines changed: 85 additions & 16 deletions

File tree

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ jobs:
5151
run: |
5252
./gradlew --stacktrace build
5353
shell: bash
54+
55+
#Run regression tests
56+
- name: Run regression test 2.5
57+
run: |
58+
./gradlew --stacktrace -PweaveTestSuiteVersion=2.5.0-SNAPSHOT native-cli-integration-tests:test
59+
shell: bash
60+
61+
- name: Run regression test 2.4
62+
run: |
63+
./gradlew --stacktrace -PweaveTestSuiteVersion=2.4.0-HF-SNAPSHOT native-cli-integration-tests:test
64+
shell: bash
5465

5566
# Generate distro
5667
- name: Create Distro

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
weaveVersion=2.6.0-SNAPSHOT
2+
weaveTestSuiteVersion=2.5.0-SNAPSHOT
23
nativeVersion=100.100.100
34
scalaVersion=2.12.11
45
ioVersion=1.0.0-SNAPSHOT

native-cli-integration-tests/build.gradle

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,45 @@ plugins {
22
id "com.github.maiflai.scalatest" version "${scalaTestPluginVersion}"
33
}
44

5+
configurations {
6+
weaveSuite
7+
}
8+
9+
sourceSets {
10+
test {
11+
resources {
12+
srcDirs += ["build/resources"]
13+
}
14+
}
15+
}
516

617
dependencies {
7-
api project(":native-cli")
18+
api(project(":native-cli"))
19+
820
testImplementation group: 'org.scalatest', name: 'scalatest_2.12', version: scalaTestVersion
921
testImplementation group: 'org.mule.weave', name: 'parser', version: weaveVersion
1022
testImplementation group: 'org.mule.weave', name: 'test-helpers', version: weaveVersion
11-
testImplementation "org.mule.weave:runtime:${weaveVersion}:test@zip"
12-
testImplementation "org.mule.weave:yaml-module:${weaveVersion}:test@zip"
23+
24+
weaveSuite "org.mule.weave:runtime:${weaveTestSuiteVersion}:test@zip"
25+
weaveSuite "org.mule.weave:yaml-module:${weaveTestSuiteVersion}:test@zip"
26+
1327
testImplementation 'commons-io:commons-io:2.11.0'
1428
testRuntimeOnly 'org.pegdown:pegdown:1.6.0'
15-
1629
testImplementation group: 'com.sun.mail', name: 'jakarta.mail', version: '1.6.4'
1730
testImplementation group: 'xerces', name: 'xercesImpl', version: '2.12.1'
1831
testImplementation group: 'xalan', name: 'xalan', version: '2.7.2'
1932
testImplementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
2033
}
2134

35+
task cleanTestSuites(type: Delete) {
36+
delete "$projectDir/build/resources/weave-suites"
37+
}
38+
39+
task downloadTestSuites(type: Copy) {
40+
from configurations.weaveSuite
41+
into "$projectDir/build/resources/weave-suites"
42+
}
43+
44+
downloadTestSuites.dependsOn(cleanTestSuites)
45+
test.dependsOn(downloadTestSuites)
2246
test.dependsOn(":native-cli:nativeCompile")

native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ import org.mule.weave.v2.parser.ast.header.directives.OutputDirective
2121
import org.mule.weave.v2.parser.ast.structure.StringNode
2222
import org.mule.weave.v2.sdk.ParsingContextFactory
2323
import org.mule.weave.v2.sdk.WeaveResourceFactory
24+
import org.mule.weave.v2.utils.DataWeaveVersion
2425
import org.mule.weave.v2.utils.StringHelper.toStringTransformer
26+
import org.mule.weave.v2.version.ComponentVersion
2527
import org.scalatest.Assertion
2628
import org.scalatest.FunSpec
2729
import org.scalatest.Matchers
30+
import sun.net.www.protocol.file.FileURLConnection
2831

2932
import java.io.ByteArrayInputStream
3033
import java.io.File
3134
import java.io.FileFilter
3235
import java.io.FileInputStream
3336
import java.io.IOException
3437
import java.io.InputStream
35-
import java.net.JarURLConnection
36-
import java.nio.charset.Charset
3738
import java.nio.charset.StandardCharsets
3839
import java.nio.file.Files
3940
import java.nio.file.Path
@@ -45,8 +46,6 @@ import javax.mail.util.ByteArrayDataSource
4546
import scala.collection.JavaConverters._
4647
import scala.io.BufferedSource
4748
import scala.io.Source
48-
import scala.io.Source.fromFile
49-
import scala.util.Try
5049

5150
class NativeCliRuntimeIT extends FunSpec
5251
with Matchers
@@ -56,20 +55,19 @@ class NativeCliRuntimeIT extends FunSpec
5655

5756
private val TIMEOUT: (Int, TimeUnit) = (30, TimeUnit.SECONDS)
5857
private val INPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern.compile("in[0-9]+-config\\.properties")
59-
private val OUTPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern.compile("out[0-9]+-config\\.properties")
58+
private val OUTPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern.compile("out[0-9]*-config\\.properties")
6059
private val INPUT_FILE_PATTERN = Pattern.compile("in[0-9]+\\.[a-zA-Z]+")
6160
private val OUTPUT_FILE_PATTERN = Pattern.compile("out\\.[a-zA-Z]+")
6261

63-
val testSuites =
64-
Seq(
65-
TestSuite("master", loadTestZipFile("access_raw_value")),
66-
TestSuite("yaml", loadTestZipFile("comments"))
62+
val testSuites = Seq(
63+
TestSuite("master", loadTestZipFile(s"weave-suites/runtime-${ComponentVersion.weaveSuiteVersion}-test.zip")),
64+
TestSuite("yaml", loadTestZipFile(s"weave-suites/yaml-module-${ComponentVersion.weaveSuiteVersion}-test.zip"))
6765
)
6866

6967
private def loadTestZipFile(testSuiteExample: String): File = {
7068
val url = getResource(testSuiteExample)
71-
val connection = url.openConnection.asInstanceOf[JarURLConnection]
72-
val zipFile = new File(connection.getJarFileURL.toURI)
69+
val connection = url.openConnection.asInstanceOf[FileURLConnection]
70+
val zipFile = new File(connection.getURL.toURI)
7371
zipFile
7472
}
7573

@@ -209,6 +207,9 @@ class NativeCliRuntimeIT extends FunSpec
209207
throw ioe
210208
}
211209

210+
val languageLevel = DataWeaveVersion(ComponentVersion.weaveSuiteVersion).toString()
211+
args = args :+ "--language-level" :+ languageLevel
212+
212213
args = args :+ "-f"
213214
args = args :+ cliTransform.getAbsolutePath
214215

@@ -354,7 +355,7 @@ class NativeCliRuntimeIT extends FunSpec
354355

355356
override def ignoreTests(): Array[String] = {
356357
// Encoding issues
357-
Array("csv-invalid-utf8") ++
358+
val baseArray = Array("csv-invalid-utf8") ++
358359
// Fail in java11 because broken backwards
359360
Array("coerciones_toString", "date-coercion") ++
360361
// Use resources (dwl files) that is present in the Tests but not in Cli (e.g: org::mule::weave::v2::libs::)
@@ -382,6 +383,7 @@ class NativeCliRuntimeIT extends FunSpec
382383
"runtime_run_coercionException",
383384
"runtime_run_fibo",
384385
"runtime_run_null_java",
386+
"sql_date_mapping",
385387
"write-function-with-null"
386388
) ++
387389
// Multipart Object has empty `parts` and expects at least one part
@@ -395,6 +397,36 @@ class NativeCliRuntimeIT extends FunSpec
395397
// Take too long time
396398
Array("array-concat") ++
397399
Array("runtime_run")
400+
401+
if (DataWeaveVersion(ComponentVersion.weaveSuiteVersion).toString() == "2.4") {
402+
baseArray ++
403+
// A change to json streaming in 2.5.0 breaks this test
404+
Array("default_with_extended_null_type") ++
405+
// Change in validations in 2.5.0 breaks these tests
406+
Array("logical-and",
407+
"logical-or"
408+
) ++
409+
Array("coerciones_toBinary") ++
410+
// 2.5.0 dwl now prints metadata breaking these tests
411+
Array("dfl-inline-default-namespace",
412+
"dfl-inline-namespace",
413+
"dfl-maxCollectionSize",
414+
"dfl-overwrite-namespace",
415+
"multipart-base64-to-multipart",
416+
"xml-nill-multiple-attributes-nested",
417+
"xml-nill-multiple-attributes",
418+
"read_scalar_values"
419+
) ++
420+
// A change of positions on dw::Core 2.5.0 breaks this test
421+
Array(
422+
"runtime_run_unhandled_compilation_exception"
423+
) ++
424+
Array("as-operator",
425+
"type-equality"
426+
)
427+
} else {
428+
baseArray
429+
}
398430
}
399431
}
400432

native-cli/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ task genVersions() {
6262
outputPrinter.println("object ComponentVersion {")
6363
outputPrinter.println("\tval weaveVersion = \"" + weaveVersion + "\"")
6464
outputPrinter.println("\tval nativeVersion = \"" + nativeVersion + "\"")
65+
outputPrinter.println("\tval weaveSuiteVersion = \"" + weaveTestSuiteVersion + "\"")
6566
outputPrinter.println("}")
6667
outputPrinter.close()
6768
}

0 commit comments

Comments
 (0)