From 4f9925a36e4cd994b39420a90187ec0ffd2aef55 Mon Sep 17 00:00:00 2001 From: Stewart Bryson Date: Fri, 18 Jan 2019 10:56:27 -0500 Subject: [PATCH 1/2] Gradle 5.1.1. upgrade. --- Jenkinsfile | 2 +- build.gradle | 16 +++++++++------- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b55b524..ac7d3d40 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { stage('Integration') { steps { - sh "$gradle ksqlServertest ksqlPipelinesTest deployTest" + sh "$gradle runAllTests" } } diff --git a/build.gradle b/build.gradle index 16b12cbc..0a3571ec 100644 --- a/build.gradle +++ b/build.gradle @@ -110,13 +110,6 @@ tasks.withType(Test) { systemProperty 'projectDir', temporaryDir } -//release.onlyIf { gradle.rootProject.extensions.analytics.gitBranch == 'master' } -//publishPlugins.onlyIf { gradle.rootProject.extensions.analytics.gitBranch == 'master' } -// -//release.doLast { -// logger.info "branch: ${gradle.rootProject.extensions.analytics.gitBranch}" -//} - testSets { ksqlServerTest ksqlPipelinesTest @@ -154,3 +147,12 @@ task publishDocs { } tasks.publishPlugins.dependsOn publishDocs + +task runAllTests { + description 'Run all defined tests.' + group 'verification' +} + +tasks.withType(Test) { + runAllTests.dependsOn it +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bfb3d170..62b8c95e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jan 10 17:57:29 EST 2019 +#Fri Jan 18 10:16:40 EST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip From 8d9dda255cce6b71c2e707f32be53edab72607b3 Mon Sep 17 00:00:00 2001 From: Stewart Bryson Date: Fri, 18 Jan 2019 16:25:06 -0500 Subject: [PATCH 2/2] Unit test changes. --- src/test/groovy/LoadConfigTest.groovy | 61 ++++++++++++++++----------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/src/test/groovy/LoadConfigTest.groovy b/src/test/groovy/LoadConfigTest.groovy index 8bdcd478..c8a3b225 100644 --- a/src/test/groovy/LoadConfigTest.groovy +++ b/src/test/groovy/LoadConfigTest.groovy @@ -15,7 +15,7 @@ class LoadConfigTest extends Specification { def result, taskList @Shared - String projectName = 'load-config' + String taskName, projectName = 'load-config' def setupSpec() { @@ -62,6 +62,26 @@ class LoadConfigTest extends Specification { processed.delete() } + // helper method + def executeSingleTask(String taskName, List args, Boolean logOutput = true) { + + args.add(0, taskName) + + log.warn "runner arguments: ${args.toString()}" + + // execute the Gradle test build + result = GradleRunner.create() + .withProjectDir(projectDir) + .withArguments(args) + .withPluginClasspath() + .build() + + // log the results + if (logOutput) log.warn result.getOutput() + + return result + } + def "Application Plugin expand works with default file"() { given: @@ -71,16 +91,11 @@ class LoadConfigTest extends Specification { TOPIC_PREFIX = 'dev-' """) - result = GradleRunner.create() - .withProjectDir(projectDir) - .withArguments('-Si', 'build', '--rerun-tasks') - .withPluginClasspath() - .build() - - log.warn result.getOutput() + taskName = 'build' + result = executeSingleTask(taskName, ['--rerun-tasks', '-Si']) expect: - ['SUCCESS', 'UP_TO_DATE', 'SKIPPED'].contains(result.task(":build").outcome.toString()) + result.task(":${taskName}").outcome.name() != 'FAILED' processed.exists() processed.text.contains('APPLICATION_ID = dev-application') processed.text.contains('TOPIC_PREFIX = dev-') @@ -95,21 +110,18 @@ class LoadConfigTest extends Specification { TOPIC_PREFIX = 'dev-' """) - result = GradleRunner.create() - .withProjectDir(projectDir) - .withArguments('-Si', 'build', "-P.confluent.configPath=streams.config", '--rerun-tasks') - .withPluginClasspath() - .build() - - log.warn result.getOutput() + taskName = 'build' + result = executeSingleTask(taskName, ['--rerun-tasks', '-Si', "-Pconfluent.configPath=streams.config"]) expect: - ['SUCCESS', 'UP_TO_DATE', 'SKIPPED'].contains(result.task(":build").outcome.toString()) + result.task(":${taskName}").outcome.name() != 'FAILED' processed.exists() processed.text.contains('APPLICATION_ID = dev-application') processed.text.contains('TOPIC_PREFIX = dev-') } + // using executeTask is not working for this test + // something to do with the "-P" parameter referencing a variable. def "Application Plugin expand works with absolute file"() { given: @@ -134,6 +146,8 @@ class LoadConfigTest extends Specification { processed.text.contains('TOPIC_PREFIX = dev-') } + // using executeTask is not working for this test + // something to do with the "-P" parameter referencing a variable. def "Application Plugin expand works with absolute file and environment"() { given: @@ -165,6 +179,8 @@ class LoadConfigTest extends Specification { processed.text.contains('TOPIC_PREFIX = test-') } + // using executeTask is not working for this test + // something to do with the "-P" parameter referencing a variable. def "Application Plugin expand works with absolute file and bogus environment"() { given: @@ -206,16 +222,11 @@ class LoadConfigTest extends Specification { applicationDefaultJvmArgs = '-Djava.io.tmpdir=/tmp' """) - result = GradleRunner.create() - .withProjectDir(projectDir) - .withArguments('-Si', 'build', '--rerun-tasks') - .withPluginClasspath() - .build() - - log.warn result.getOutput() + taskName = 'build' + result = executeSingleTask(taskName, ['--rerun-tasks', '-Si']) expect: - ['SUCCESS', 'UP_TO_DATE', 'SKIPPED'].contains(result.task(":build").outcome.toString()) + result.task(":${taskName}").outcome.name() != 'FAILED' unixScript.exists() unixScript.text.contains('''DEFAULT_JVM_OPTS="-Djava.io.tmpdir=/tmp"''') windowsScript.exists()