You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by mm...@apache.org on 2021/03/24 18:49:51 UTC

[bookkeeper] branch master updated: ISSUE-2640: BP-43: Gradle: Run tests in :stream gradle (#2659)

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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b90867  ISSUE-2640: BP-43: Gradle: Run tests in :stream gradle (#2659)
5b90867 is described below

commit 5b90867c91abb95df6957ee79ffbb494db9321e8
Author: Prashant Kumar <65...@users.noreply.github.com>
AuthorDate: Wed Mar 24 11:49:43 2021 -0700

    ISSUE-2640: BP-43: Gradle: Run tests in :stream gradle (#2659)
    
    * Make gradle use os specific paths in build
    
    * ISSUE-2640: BP-43: make unit tests run with gradle.
    
    Co-authored-by: Ali Ahmed <al...@gmail.com>
    Co-authored-by: Prashant Kumar <pr...@splunk.com>
---
 build.gradle                                       |  4 +++
 circe-checksum/src/main/circe/build.gradle         |  9 ++++--
 cpu-affinity/src/main/affinity/build.gradle        |  9 ++++++
 dependencies.gradle                                | 35 ++++++++++++++++++----
 settings.gradle                                    | 21 ++++++++++---
 stream/clients/java/base/build.gradle              |  4 +++
 stream/common/build.gradle                         |  2 +-
 stream/distributedlog/core/build.gradle            | 14 +++++++++
 stream/server/build.gradle                         |  3 +-
 stream/statelib/build.gradle                       |  9 ++++++
 .../integration-tests-topologies}/build.gradle     | 19 ++++--------
 .../integration-tests-utils}/build.gradle          | 21 ++++++-------
 .../integration/cluster}/build.gradle              | 27 ++++++++++-------
 .../integration/smoke}/build.gradle                | 21 ++++++-------
 .../integration/standalone}/build.gradle           | 21 ++++++-------
 15 files changed, 148 insertions(+), 71 deletions(-)

diff --git a/build.gradle b/build.gradle
index a478817..7c5bc74 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,10 @@ plugins {
     id 'java'
 }
 
+subprojects {
+    task allDeps(type: DependencyReportTask) {}
+}
+
 allprojects {
     apply from: "$rootDir/dependencies.gradle"
 
diff --git a/circe-checksum/src/main/circe/build.gradle b/circe-checksum/src/main/circe/build.gradle
index 4679f89..5b49ba8 100644
--- a/circe-checksum/src/main/circe/build.gradle
+++ b/circe-checksum/src/main/circe/build.gradle
@@ -31,8 +31,13 @@ library {
         compileTask.includes.from("${Jvm.current().javaHome}/include",
                                   project(':circe-checksum').generateJniHeaders.javahOutputDir)
 
-        compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
-        compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
+        def osFamily = binary.targetPlatform.targetMachine.operatingSystemFamily
+
+        if (osFamily.linux) {
+            compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
+        } else if (osFamily.macOs) {
+            compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
+        }
 
         compileTask.source.from fileTree(dir: "cpp", include: "**/*.cpp")
         compileTask.compilerArgs.addAll(["-msse4.2", "-mpclmul", "-O3"])
diff --git a/cpu-affinity/src/main/affinity/build.gradle b/cpu-affinity/src/main/affinity/build.gradle
index c2ed921..2e44423 100644
--- a/cpu-affinity/src/main/affinity/build.gradle
+++ b/cpu-affinity/src/main/affinity/build.gradle
@@ -28,6 +28,15 @@ library {
         compileTask.dependsOn project(':cpu-affinity').generateJniHeaders
         compileTask.includes.from("${Jvm.current().javaHome}/include",
                                   project(':cpu-affinity').generateJniHeaders.javahOutputDir)
+
+        def osFamily = binary.targetPlatform.targetMachine.operatingSystemFamily
+
+        if (osFamily.linux) {
+            compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
+        } else if (osFamily.macOs) {
+            compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
+        }
+
         compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
         compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
         compileTask.source.from fileTree(dir: "cpp", include: "**/*.c")
diff --git a/dependencies.gradle b/dependencies.gradle
index 89089cc..d26090e 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -22,20 +22,27 @@ ext {
 }
 
 depVersions = [
+    arquillianCubeDocker: "1.18.2",
+    arquillianJunit: "1.6.0.Final",
     bcFips: "1.0.1",
     bouncycastle: "1.60",
-    commonsCli: "1.2",
-    commonsCodec: "1.6",
+    commonsCli: "1.4",
+    commonsCodec: "1.14",
     commonsCollections4: "4.1",
+    commonsCompress: "1.19",
     commonsConfiguration: "1.10",
     commonsIO: "2.4",
     commonsLang2: "2.6",
     commonsLang3: "3.6",
+    commonsBeanutils: "1.9.3",
     curator: "4.0.1",
+    dockerJava: "3.2.5",
     errorprone: "2.1.2",
     freebuilder: "1.14.9",
+    gradleTooling: "4.0.1",
     grpc: "1.33.0",
-    guava: "21.0",
+    groovy: "2.5.8",
+    guava: "30.1-jre",
     hamcrest: "1.3",
     httpclient: "4.5.13",
     jackson: "2.9.7",
@@ -52,6 +59,7 @@ depVersions = [
     lombok: "1.18.10",
     lz4: "1.3.0",
     mockito: "3.0.0",
+    metrics_core: "4.1.13",
     netty: "4.1.32.Final",
     nettyTcnativeBoringSsl: "2.0.20.Final",
     powermock: "2.0.2",
@@ -61,8 +69,11 @@ depVersions = [
     slf4j: "1.7.25",
     spotbugsAnnotations: "3.1.8",
     protocGenGrpcJava: "1.12.0",
-    thrift: "0.9.3",
-    vertx: "3.4.1",
+    shrinkwrap:"3.1.4",
+    snappy: "1.1.7.7",
+    thrift: "0.12.0",
+    testcontainers: "1.14.3",
+    vertx: "3.9.2",
     yahooDatasketches: "0.8.3",
     zookeeper: "3.4.13",
 ]
@@ -72,17 +83,25 @@ depLibs = [
     bcproveExtJdk15on: "org.bouncycastle:bcprov-ext-jdk15on:${depVersions.bouncycastle}",
     bcFips: "org.bouncycastle:bc-fips:${depVersions.bcFips}",
     commonsCli: "commons-cli:commons-cli:${depVersions.commonsCli}",
+    arquillianCubeDocker: "org.arquillian.cube:arquillian-cube-docker:${depVersions.arquillianCubeDocker}",
+    arquillianJunitContainer: "org.jboss.arquillian.junit:arquillian-junit-container:${depVersions.arquillianJunit}",
+    arquillianJunitStandalone: "org.jboss.arquillian.junit:arquillian-junit-standalone:${depVersions.arquillianJunit}",
     commonsCodec: "commons-codec:commons-codec:${depVersions.commonsCodec}",
     commonsCollections4: "org.apache.commons:commons-collections4:${depVersions.commonsCollections4}",
+    commonsCompress: "org.apache.commons:commons-compress:${depVersions.commonsCompress}",
     commonsConfiguration: "commons-configuration:commons-configuration:${depVersions.commonsConfiguration}",
     commonsIO: "commons-io:commons-io:${depVersions.commonsIO}",
     commonsLang2: "commons-lang:commons-lang:${depVersions.commonsLang2}",
     commonsLang3: "org.apache.commons:commons-lang3:${depVersions.commonsLang3}",
+    commonsBeanutils: "commons-beanutils:commons-beanutils:${depVersions.commonsBeanutils}",
     curatorFramework: "org.apache.curator:curator-framework:${depVersions.curator}",
     curatorRecipes: "org.apache.curator:curator-recipes:${depVersions.curator}",
+    dockerJava: "com.github.docker-java:docker-java:${depVersions.dockerJava}",
     errorprone: "com.google.errorprone:error_prone_annotations:${depVersions.errorprone}",
     freebuilder: "org.inferred:freebuilder:${depVersions.freebuilder}",
+    gradleTooling: "org.gradle:gradle-tooling-api:${depVersions.gradleTooling}",
     grpc: "io.grpc:grpc-all:${depVersions.grpc}",
+    groovy: "org.codehaus.groovy:groovy-all:${depVersions.groovy}",
     guava: "com.google.guava:guava:${depVersions.guava}",
     hamcrest: "org.hamcrest:hamcrest-all:${depVersions.hamcrest}",
     httpclient: "org.apache.httpcomponents:httpclient:${depVersions.httpclient}",
@@ -101,6 +120,7 @@ depLibs = [
     log4j: "log4j:log4j:${depVersions.log4j}",
     lombok: "org.projectlombok:lombok:${depVersions.lombok}",
     lz4: "net.jpountz.lz4:lz4:${depVersions.lz4}",
+    metricsCore: "io.dropwizard.metrics:metrics-core:${depVersions.metrics_core}",
     mockito: "org.mockito:mockito-core:${depVersions.mockito}",
     nettyBuffer: "io.netty:netty-buffer:${depVersions.netty}",
     nettyCommon: "io.netty:netty-common:${depVersions.netty}",
@@ -117,9 +137,14 @@ depLibs = [
     protoc: "com.google.protobuf:protoc:${depVersions.protobuf}",
     rocksDb: "org.rocksdb:rocksdbjni:${depVersions.rocksDb}",
     slf4j: "org.slf4j:slf4j-api:${depVersions.slf4j}",
+    slf4jSimple: "org.slf4j:slf4j-simple:${depVersions.slf4j}",
     slf4jLog4j: "org.slf4j:slf4j-log4j12:${depVersions.slf4j}",
+    shrinkwrapImpl: "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:${depVersions.shrinkwrap}",
+    shrinkwrapApi: "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:${depVersions.shrinkwrap}",
+    snappy: "org.xerial.snappy:snappy-java:${depVersions.snappy}",
     spotbugsAnnotations: "com.github.spotbugs:spotbugs-annotations:${depVersions.spotbugsAnnotations}",
     thrift: "org.apache.thrift:libthrift:${depVersions.thrift}",
+    testcontainers: "org.testcontainers:testcontainers:${depVersions.testcontainers}",
     vertxCore: "io.vertx:vertx-core:${depVersions.vertx}",
     vertxWeb: "io.vertx:vertx-web:${depVersions.vertx}",
     yahooDatasketches: "com.yahoo.datasketches:sketches-core:${depVersions.yahooDatasketches}",
diff --git a/settings.gradle b/settings.gradle
index 44e76bd..64bb5f3 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -24,10 +24,23 @@ pluginManagement {
 
 rootProject.name = 'bookkeeper'
 
-include('circe-checksum', 'circe-checksum:src:main:circe',
-        'cpu-affinity', 'cpu-affinity:src:main:affinity', 'bookkeeper-common',
-        'bookkeeper-http:http-server', 'bookkeeper-server',
-        'bookkeeper-common-allocator', 'bookkeeper-proto', 'bookkeeper-stats',
+include('circe-checksum',
+        'circe-checksum:src:main:circe',
+        'cpu-affinity',
+        'cpu-affinity:src:main:affinity',
+        'bookkeeper-common',
+        'bookkeeper-http:http-server',
+        'bookkeeper-http:vertx-http-server',
+        'bookkeeper-server',
+        'bookkeeper-common-allocator',
+        'bookkeeper-proto',
+        'bookkeeper-stats',
+        'tests:integration-tests-base',
+        'tests:integration-tests-utils',
+        'tests:integration-tests-topologies',
+        'tests:integration:cluster',
+        'tests:integration:smoke',
+        'tests:integration:standalone',
         'bookkeeper-stats-providers:prometheus-metrics-provider',
         'tools:framework',
         'stream:distributedlog:common', 'stream:distributedlog:protocol', 'stream:distributedlog:core',
diff --git a/stream/clients/java/base/build.gradle b/stream/clients/java/base/build.gradle
index 8cf5fe8..1652010 100644
--- a/stream/clients/java/base/build.gradle
+++ b/stream/clients/java/base/build.gradle
@@ -34,6 +34,10 @@ dependencies {
     annotationProcessor depLibs.lombok
 }
 
+configurations {
+    testCompile.exclude group:'io.grpc', module: 'grpc-netty-shaded'
+}
+
 publishing {
     publications {
         maven(MavenPublication) {
diff --git a/stream/common/build.gradle b/stream/common/build.gradle
index 4b789ca..daa2b31 100644
--- a/stream/common/build.gradle
+++ b/stream/common/build.gradle
@@ -24,7 +24,7 @@ dependencies {
     implementation depLibs.jsr305
     implementation depLibs.lombok
     implementation depLibs.slf4j
-
+    testImplementation depLibs.mockito
     testImplementation project(':stream:tests-common')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
     annotationProcessor depLibs.lombok
diff --git a/stream/distributedlog/core/build.gradle b/stream/distributedlog/core/build.gradle
index 8efe8e0..7ca40df 100644
--- a/stream/distributedlog/core/build.gradle
+++ b/stream/distributedlog/core/build.gradle
@@ -16,6 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+plugins {
+    id 'java'
+}
+
 dependencies {
     implementation project(':bookkeeper-common')
     implementation project(':bookkeeper-server')
@@ -45,6 +49,16 @@ dependencies {
     testAnnotationProcessor depLibs.lombok
 }
 
+test {
+    maxHeapSize = '4G'
+    forkEvery = 1
+}
+
+test.doFirst {
+    jvmArgs("-Djunit.timeout.test=600000", "-Djunit.max.retry=3",
+            "-Djava.net.preferIPv4Stack=true", "-Dio.netty.leakDetection.level=paranoid")
+}
+
 publishing {
     publications {
         maven(MavenPublication) {
diff --git a/stream/server/build.gradle b/stream/server/build.gradle
index 8fc3068..af36a7c 100644
--- a/stream/server/build.gradle
+++ b/stream/server/build.gradle
@@ -31,13 +31,14 @@ dependencies {
     implementation project(':stream:storage:impl')
 
     implementation depLibs.commonsConfiguration
-    implementation depLibs.commonsLang3
+    implementation depLibs.commonsLang2
     implementation depLibs.curatorFramework
     implementation depLibs.grpc
     implementation depLibs.guava
     implementation depLibs.jcommander
     implementation depLibs.lombok
     implementation depLibs.slf4j
+    testImplementation depLibs.mockito
 
     annotationProcessor depLibs.lombok
 }
diff --git a/stream/statelib/build.gradle b/stream/statelib/build.gradle
index 6f9c04f..d2d9832 100644
--- a/stream/statelib/build.gradle
+++ b/stream/statelib/build.gradle
@@ -44,6 +44,10 @@ dependencies {
     testImplementation depLibs.commonsIO
     testImplementation depLibs.junit
     testImplementation depLibs.mockito
+    testImplementation depLibs.metricsCore
+    testImplementation depLibs.snappy
+    testImplementation depLibs.slf4jSimple
+    runtimeOnly depLibs.commonsBeanutils
     testImplementation project(path: ':stream:distributedlog:core', configuration: 'testArtifacts')
 
     annotationProcessor depLibs.lombok
@@ -67,3 +71,8 @@ protobuf {
         }
     }
 }
+
+test {
+    maxHeapSize = '2G'
+    forkEvery = 1
+}
diff --git a/stream/clients/java/base/build.gradle b/tests/integration-tests-topologies/build.gradle
similarity index 72%
copy from stream/clients/java/base/build.gradle
copy to tests/integration-tests-topologies/build.gradle
index 8cf5fe8..a97b034 100644
--- a/stream/clients/java/base/build.gradle
+++ b/tests/integration-tests-topologies/build.gradle
@@ -17,27 +17,20 @@
  * under the License.
  */
 dependencies {
-    implementation project(':bookkeeper-common')
-    implementation project(':bookkeeper-stats')
-    implementation project(':stream:common')
-    implementation project(':stream:proto')
-
-    implementation depLibs.commonsLang2
-    implementation depLibs.freebuilder
-    implementation depLibs.grpc
+    implementation project(':tests:integration-tests-utils')
+    implementation depLibs.testcontainers
+    implementation depLibs.junit
     implementation depLibs.lombok
     implementation depLibs.slf4j
-
-    testImplementation depLibs.mockito
-
-    annotationProcessor depLibs.freebuilder
+    implementation depLibs.guava
+    implementation depLibs.commonsLang2
     annotationProcessor depLibs.lombok
 }
 
 publishing {
     publications {
         maven(MavenPublication) {
-            artifactId = 'stream-storage-java-client-base'
+            artifactId = 'integration-tests-topologies'
         }
     }
 }
diff --git a/stream/common/build.gradle b/tests/integration-tests-utils/build.gradle
similarity index 70%
copy from stream/common/build.gradle
copy to tests/integration-tests-utils/build.gradle
index 4b789ca..9940ff9 100644
--- a/stream/common/build.gradle
+++ b/tests/integration-tests-utils/build.gradle
@@ -17,25 +17,26 @@
  * under the License.
  */
 dependencies {
-    implementation project(':bookkeeper-common')
-    implementation project(':bookkeeper-stats')
-    implementation depLibs.grpc
-    implementation depLibs.guava
-    implementation depLibs.jsr305
+    implementation depLibs.arquillianCubeDocker
+    implementation depLibs.zookeeper
+    implementation depLibs.junit
     implementation depLibs.lombok
     implementation depLibs.slf4j
-
-    testImplementation project(':stream:tests-common')
-    testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
+    implementation depLibs.groovy
+    implementation depLibs.shrinkwrapImpl
+    implementation depLibs.shrinkwrapApi
+    implementation depLibs.dockerJava
     annotationProcessor depLibs.lombok
-    testAnnotationProcessor depLibs.lombok
 }
 
+test {
+    exclude '**/MavenClassLoaderTest.class'
+}
 
 publishing {
     publications {
         maven(MavenPublication) {
-            artifactId = 'stream-storage-common'
+            artifactId = 'integration-tests-utils'
         }
     }
 }
diff --git a/stream/common/build.gradle b/tests/integration/cluster/build.gradle
similarity index 58%
copy from stream/common/build.gradle
copy to tests/integration/cluster/build.gradle
index 4b789ca..417e6f3 100644
--- a/stream/common/build.gradle
+++ b/tests/integration/cluster/build.gradle
@@ -17,25 +17,30 @@
  * under the License.
  */
 dependencies {
-    implementation project(':bookkeeper-common')
-    implementation project(':bookkeeper-stats')
     implementation depLibs.grpc
-    implementation depLibs.guava
-    implementation depLibs.jsr305
-    implementation depLibs.lombok
-    implementation depLibs.slf4j
-
-    testImplementation project(':stream:tests-common')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
-    annotationProcessor depLibs.lombok
+    testImplementation project(':stream:api')
+    testImplementation project(':stream:storage:api')
+    testImplementation project(':stream:common')
+    testImplementation project(':stream:proto')
+    testImplementation project(':stream:storage:impl')
+    testImplementation project(':stream:clients:java:base')
+    testImplementation project(':stream:clients:java:all')
+    testImplementation project(':bookkeeper-server')
+    testImplementation project(':bookkeeper-stats')
+    testImplementation project(':tests:integration-tests-topologies')
+
+    testCompileOnly depLibs.lombok
+    testImplementation depLibs.slf4jLog4j
+    testImplementation depLibs.testcontainers
+    testImplementation depLibs.commonsConfiguration
     testAnnotationProcessor depLibs.lombok
 }
 
-
 publishing {
     publications {
         maven(MavenPublication) {
-            artifactId = 'stream-storage-common'
+            artifactId = 'tests-integration-cluster'
         }
     }
 }
diff --git a/stream/common/build.gradle b/tests/integration/smoke/build.gradle
similarity index 69%
copy from stream/common/build.gradle
copy to tests/integration/smoke/build.gradle
index 4b789ca..f19a72c 100644
--- a/stream/common/build.gradle
+++ b/tests/integration/smoke/build.gradle
@@ -17,25 +17,22 @@
  * under the License.
  */
 dependencies {
-    implementation project(':bookkeeper-common')
-    implementation project(':bookkeeper-stats')
-    implementation depLibs.grpc
-    implementation depLibs.guava
-    implementation depLibs.jsr305
-    implementation depLibs.lombok
-    implementation depLibs.slf4j
-
-    testImplementation project(':stream:tests-common')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
-    annotationProcessor depLibs.lombok
+    testImplementation project(':bookkeeper-server')
+    testImplementation project(':tests:integration-tests-utils')
+    testCompileOnly depLibs.lombok
+    testImplementation depLibs.arquillianJunitContainer
+    testImplementation depLibs.arquillianJunitStandalone
+    testImplementation depLibs.testcontainers
+    testImplementation depLibs.commonsConfiguration
+    testImplementation depLibs.arquillianCubeDocker
     testAnnotationProcessor depLibs.lombok
 }
 
-
 publishing {
     publications {
         maven(MavenPublication) {
-            artifactId = 'stream-storage-common'
+            artifactId = 'tests-integration-cluster'
         }
     }
 }
diff --git a/stream/common/build.gradle b/tests/integration/standalone/build.gradle
similarity index 68%
copy from stream/common/build.gradle
copy to tests/integration/standalone/build.gradle
index 4b789ca..0058d7e 100644
--- a/stream/common/build.gradle
+++ b/tests/integration/standalone/build.gradle
@@ -17,25 +17,22 @@
  * under the License.
  */
 dependencies {
-    implementation project(':bookkeeper-common')
-    implementation project(':bookkeeper-stats')
-    implementation depLibs.grpc
-    implementation depLibs.guava
-    implementation depLibs.jsr305
-    implementation depLibs.lombok
-    implementation depLibs.slf4j
-
-    testImplementation project(':stream:tests-common')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
-    annotationProcessor depLibs.lombok
+    testImplementation project(':bookkeeper-server')
+    testImplementation project(':tests:integration-tests-utils')
+    testImplementation project(':tests:integration-tests-topologies')
+    testCompileOnly depLibs.lombok
+    testImplementation depLibs.arquillianJunitContainer
+    testImplementation depLibs.testcontainers
+    testImplementation depLibs.commonsConfiguration
+    testImplementation depLibs.arquillianCubeDocker
     testAnnotationProcessor depLibs.lombok
 }
 
-
 publishing {
     publications {
         maven(MavenPublication) {
-            artifactId = 'stream-storage-common'
+            artifactId = 'tests-integration-cluster'
         }
     }
 }