From b58b54dab97045abaca4dd689f1426c99f5e3d65 Mon Sep 17 00:00:00 2001 From: Tyler Benson Date: Mon, 12 Nov 2018 12:33:34 -0800 Subject: [PATCH] Limit Lettuce/Webflux versions and fix test for tomcat 9+ --- .../src/test/groovy/JSPInstrumentationBasicTests.groovy | 1 + .../src/test/groovy/JSPInstrumentationForwardTests.groovy | 1 + dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle | 3 ++- .../servlet-3/src/test/groovy/TomcatServlet3Test.groovy | 1 + .../instrumentation/spring-webflux/spring-webflux.gradle | 7 ++++--- .../src/test/groovy/SpringWebfluxTest.groovy | 5 ----- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy index 0ce5e85558..48b521b86c 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy @@ -54,6 +54,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { tomcatServer = new Tomcat() tomcatServer.setBaseDir(baseDir.getAbsolutePath()) tomcatServer.setPort(port) + tomcatServer.getConnector() // comment to debug tomcatServer.setSilent(true) // this is needed in tomcat 9, this triggers the creation of a connector, will not diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy index 3a888113f3..94132aff2d 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy @@ -52,6 +52,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { tomcatServer = new Tomcat() tomcatServer.setBaseDir(baseDir.getAbsolutePath()) tomcatServer.setPort(port) + tomcatServer.getConnector() // comment to debug tomcatServer.setSilent(true) // this is needed in tomcat 9, this triggers the creation of a connector, will not diff --git a/dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle b/dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle index 09c011727a..4c366a4f71 100644 --- a/dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle +++ b/dd-java-agent/instrumentation/lettuce-5/lettuce-5.gradle @@ -62,5 +62,6 @@ dependencies { testCompile group: 'com.github.kstyrc', name: 'embedded-redis', version: '0.6' testCompile group: 'io.lettuce', name: 'lettuce-core', version: '5.0.0.RELEASE' - latestDepTestCompile group: 'io.lettuce', name: 'lettuce-core', version: '+' + // FIXME: Tests need to be updated to support 5.1+ + latestDepTestCompile group: 'io.lettuce', name: 'lettuce-core', version: '5.0.+' } diff --git a/dd-java-agent/instrumentation/servlet-3/src/test/groovy/TomcatServlet3Test.groovy b/dd-java-agent/instrumentation/servlet-3/src/test/groovy/TomcatServlet3Test.groovy index 01b9883ea7..d823067a11 100644 --- a/dd-java-agent/instrumentation/servlet-3/src/test/groovy/TomcatServlet3Test.groovy +++ b/dd-java-agent/instrumentation/servlet-3/src/test/groovy/TomcatServlet3Test.groovy @@ -27,6 +27,7 @@ class TomcatServlet3Test extends AgentTestRunner { port = TestUtils.randomOpenPort() tomcatServer = new Tomcat() tomcatServer.setPort(port) + tomcatServer.getConnector() def baseDir = Files.createTempDir() baseDir.deleteOnExit() diff --git a/dd-java-agent/instrumentation/spring-webflux/spring-webflux.gradle b/dd-java-agent/instrumentation/spring-webflux/spring-webflux.gradle index 6bccc94370..39f85326b9 100644 --- a/dd-java-agent/instrumentation/spring-webflux/spring-webflux.gradle +++ b/dd-java-agent/instrumentation/spring-webflux/spring-webflux.gradle @@ -75,7 +75,8 @@ dependencies { testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.0.RELEASE' testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-reactor-netty', version: '2.0.0.RELEASE' - latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-webflux', version: '+' - latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '+' - latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-reactor-netty', version: '+' + // FIXME: Tests need to be updated to support 2.1+ + latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-webflux', version: '2.0.+' + latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.+' + latestDepTestCompile group: 'org.springframework.boot', name: 'spring-boot-starter-reactor-netty', version: '2.0.+' } diff --git a/dd-java-agent/instrumentation/spring-webflux/src/test/groovy/SpringWebfluxTest.groovy b/dd-java-agent/instrumentation/spring-webflux/src/test/groovy/SpringWebfluxTest.groovy index d902b430c8..c7d92578ce 100644 --- a/dd-java-agent/instrumentation/spring-webflux/src/test/groovy/SpringWebfluxTest.groovy +++ b/dd-java-agent/instrumentation/spring-webflux/src/test/groovy/SpringWebfluxTest.groovy @@ -13,7 +13,6 @@ import okhttp3.RequestBody import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.web.server.LocalServerPort import org.springframework.web.server.ResponseStatusException -import spock.lang.Unroll @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringWebFluxTestApplication) class SpringWebfluxTest extends AgentTestRunner { @@ -27,7 +26,6 @@ class SpringWebfluxTest extends AgentTestRunner { OkHttpClient client = OkHttpUtils.client() - @Unroll def "Basic GET test #testName to functional API"() { setup: String url = "http://localhost:$port/greet$urlSuffix" @@ -82,7 +80,6 @@ class SpringWebfluxTest extends AgentTestRunner { "with two parameters" | "/World/Test1" | "/{name}/{word}" | SpringWebFluxTestApplication.GreetingHandler.DEFAULT_RESPONSE + " World Test1" } - @Unroll def "Basic GET test #testName to annotations API"() { setup: String url = "http://localhost:$port/foo$urlSuffix" @@ -417,7 +414,6 @@ class SpringWebfluxTest extends AgentTestRunner { } } - @Unroll def "Flux x#count GET test with functional API endpoint"() { setup: String expectedResponseBodyStr = FooModel.createXFooModelsStringFromArray(FooModel.createXFooModels(count)) @@ -471,7 +467,6 @@ class SpringWebfluxTest extends AgentTestRunner { count << [0, 1, 10] } - @Unroll def "Flux x#count GET test with spring annotations endpoint"() { setup: String expectedResponseBodyStr = FooModel.createXFooModelsStringFromArray(FooModel.createXFooModels(count))