Skip to content

Commit

Permalink
Add smoke test for websphere, update smoke test server versions (open…
Browse files Browse the repository at this point in the history
…-telemetry#4613)

* Add smoke test for websphere, update smoke test server versions

* update workflows

* fix workflow

* Apply suggestions from code review

Co-authored-by: Trask Stalnaker <[email protected]>

* revert accidental change

Co-authored-by: Trask Stalnaker <[email protected]>
  • Loading branch information
2 people authored and RashmiRam committed May 23, 2022
1 parent 439826c commit d407ced
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nightly-no-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/patch-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
steps:
- name: Support longpaths
run: git config --system core.longpaths true
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/pr-smoke-test-servlet-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ jobs:
- payara
- tomcat
- tomee
- wildfly
- websphere
- wildfly
exclude:
- os: windows-latest
smoke-test-server: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down Expand Up @@ -58,4 +61,4 @@ jobs:
- name: Build Windows docker images
working-directory: smoke-tests/images/servlet
run: ./gradlew buildWindowsTestImages -PsmokeTestServer=${{ matrix.smoke-test-server }}
if: matrix.os == 'windows-latest' && matrix.smoke-test-server != 'websphere'
if: matrix.os == 'windows-latest'
4 changes: 4 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/publish-smoke-test-servlet-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ jobs:
- payara
- tomcat
- tomee
- wildfly
- websphere
- wildfly
exclude:
- os: windows-latest
smoke-test-server: websphere
fail-fast: false
steps:
- name: Support longpaths
Expand Down Expand Up @@ -77,7 +80,7 @@ jobs:
TAG="$(date '+%Y%m%d').$GITHUB_RUN_ID"
echo "Using extra tag $TAG"
./gradlew buildWindowsTestImages pushMatrix -PextraTag=$TAG -PsmokeTestServer=${{ matrix.smoke-test-server }}
if: matrix.os == 'windows-latest' && matrix.smoke-test-server != 'websphere'
if: matrix.os == 'windows-latest'

issue:
name: Open issue on failure
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ jobs:
- liberty
- tomcat
- tomee
- websphere
- wildfly
- other
exclude:
- os: windows-latest
smoke-test-suite: websphere
steps:
- name: Support longpaths
run: git config --system core.longpaths true
Expand Down
11 changes: 6 additions & 5 deletions docs/supported-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ These are the supported application servers:
| [Payara](https://www.payara.fish/) | 5.0.x, 5.1.x | OpenJDK 8, 11 | Ubuntu 18, Windows Server 2019 |
| [Tomcat](http://tomcat.apache.org/) | 7.0.x, 8.5.x, 9.0.x, 10.0.x | OpenJDK 8, 11 | Ubuntu 18 |
| [TomEE](https://tomee.apache.org/) | 7.x, 8.x | OpenJDK 8, 11 | Ubuntu 18 |
| [Weblogic](https://www.oracle.com/java/weblogic/) | 12 | Oracle JDK 8 | Oracle Linux 7, 8 |
| [Weblogic](https://www.oracle.com/java/weblogic/) | 14 | Oracle JDK 8, 11 | Oracle Linux 7, 8 |
| [Websphere Liberty Profile](https://www.ibm.com/cloud/websphere-liberty) | 20.0.0.12 | OpenJDK 8, 11 | Ubuntu 18, Windows Server 2019 |
| [WildFly](https://www.wildfly.org/) | 13.0.x | OpenJDK 8 | Ubuntu 18, Windows Server 2019 |
| [WildFly](https://www.wildfly.org/) | 17.0.1, 21.0.0 | OpenJDK 8, 11 | Ubuntu 18, Windows Server 2019 |
| [Weblogic](https://www.oracle.com/java/weblogic/) | 12.x | Oracle JDK 8 | Oracle Linux 7, 8 |
| [Weblogic](https://www.oracle.com/java/weblogic/) | 14.x | Oracle JDK 8, 11 | Oracle Linux 7, 8 |
| [Websphere Liberty Profile](https://www.ibm.com/cloud/websphere-liberty) | 20.x, 21.x | OpenJDK 8, 11 | Ubuntu 18, Windows Server 2019 |
| [Websphere Traditional](https://www.ibm.com/cloud/websphere-application-server) | 8.5.x, 9.0.x | IBM JDK 8 | Red Hat Enterprise Linux 8.4 |
| [WildFly](https://www.wildfly.org/) | 13.x | OpenJDK 8 | Ubuntu 18, Windows Server 2019 |
| [WildFly](https://www.wildfly.org/) | 17.x, 21.x, 25.x | OpenJDK 8, 11 | Ubuntu 18, Windows Server 2019 |

## JVMs and operating systems

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
named("handleRequest")
.and(takesArgument(0, named("javax.servlet.ServletRequest")))
.and(takesArgument(1, named("javax.servlet.ServletResponse")))
.and(takesArgument(2, named("com.ibm.wsspi.http.HttpInboundConnection"))),
.and(takesArgument(1, named("javax.servlet.ServletResponse"))),
this.getClass().getName() + "$HandleRequestAdvice");

// isForbidden is called from handleRequest
Expand All @@ -52,9 +51,15 @@ public static class HandleRequestAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.Argument(value = 0) ServletRequest request,
@Advice.Argument(value = 1) ServletResponse response) {

if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
@Advice.Argument(value = 1) ServletResponse response,
@Advice.Local("otelHandled") boolean handled) {

// liberty has two handleRequest methods, skip processing when thread local context is already
// set up
handled = ThreadLocalContext.get() == null;
if (!handled
|| !(request instanceof HttpServletRequest)
|| !(response instanceof HttpServletResponse)) {
return;
}

Expand All @@ -69,7 +74,11 @@ public static void onEnter(
public static void stopSpan(
@Advice.Argument(0) ServletRequest servletRequest,
@Advice.Argument(1) ServletResponse servletResponse,
@Advice.Thrown Throwable throwable) {
@Advice.Thrown Throwable throwable,
@Advice.Local("otelHandled") boolean handled) {
if (!handled) {
return;
}
ThreadLocalContext requestInfo = ThreadLocalContext.endRequest();
if (requestInfo == null) {
return;
Expand Down
1 change: 1 addition & 0 deletions smoke-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ tasks {
"liberty" to listOf("**/Liberty*.*"),
"tomcat" to listOf("**/Tomcat*.*"),
"tomee" to listOf("**/Tomee*.*"),
"websphere" to listOf("**/Websphere*.*"),
"wildfly" to listOf("**/Wildfly*.*")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class AppServerTest extends SmokeTest {
@Override
protected String getTargetImage(String jdk, String serverVersion, boolean windows) {
String platformSuffix = windows ? "-windows" : ""
String extraTag = "20211020.1362390004"
String extraTag = "20211108.1435776715"
String fullSuffix = "${serverVersion}-jdk$jdk$platformSuffix-$extraTag"
return getTargetImagePrefix() + ":" + fullSuffix
}
Expand All @@ -75,6 +75,10 @@ abstract class AppServerTest extends SmokeTest {
true
}

boolean testRequestOutsideDeployedApp() {
true
}

//TODO add assert that server spans were created by servers, not by servlets
@Unroll
def "#appServer smoke test on JDK #jdk"(String appServer, String jdk, boolean isWindows) {
Expand Down Expand Up @@ -272,6 +276,7 @@ abstract class AppServerTest extends SmokeTest {

@Unroll
def "#appServer test request outside deployed application JDK #jdk"(String appServer, String jdk, boolean isWindows) {
assumeTrue(testRequestOutsideDeployedApp())
def currentAgentVersion = new JarFile(agentPath).getManifest().getMainAttributes().get(Attributes.Name.IMPLEMENTATION_VERSION)

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,26 @@ abstract class GlassFishSmokeTest extends AppServerTest {
}

@AppServer(version = "5.2020.6", jdk = "8")
class GlassFish5Jdk8 extends GlassFishSmokeTest {
class GlassFish52020Jdk8 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2020.6", jdk = "8-openj9")
class GlassFish5Jdk8Openj9 extends GlassFishSmokeTest {
class GlassFish52020Jdk8Openj9 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2020.6", jdk = "11")
class GlassFish5Jdk11 extends GlassFishSmokeTest {
class GlassFish52020Jdk11 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2020.6", jdk = "11-openj9")
class GlassFish5Jdk11Openj9 extends GlassFishSmokeTest {
class GlassFish52020Jdk11Openj9 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2021.8", jdk = "8")
class GlassFish52021Jdk8 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2021.8", jdk = "8-openj9")
class GlassFish52021Jdk8Openj9 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2021.8", jdk = "11")
class GlassFish52021Jdk11 extends GlassFishSmokeTest {
}
@AppServer(version = "5.2021.8", jdk = "11-openj9")
class GlassFish52021Jdk11Openj9 extends GlassFishSmokeTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

package io.opentelemetry.smoketest

@AppServer(version = "20.0.0.12", jdk = "8")
class LibertyServletOnlySmokeTest extends LibertySmokeTest {
abstract class LibertyServletOnlySmokeTest extends LibertySmokeTest {

@Override
protected List<ResourceMapping> getExtraResources() {
Expand All @@ -28,3 +27,10 @@ class LibertyServletOnlySmokeTest extends LibertySmokeTest {
return super.getSpanName(path)
}
}

@AppServer(version = "20.0.0.12", jdk = "11")
class LibertyServletOnly20Jdk11 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "11")
class LibertyServletOnly21Jdk11 extends LibertySmokeTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,21 @@ class Liberty20Jdk16 extends LibertySmokeTest {
@AppServer(version = "20.0.0.12", jdk = "16-openj9")
class Liberty20Jdk16Openj9 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "8")
class Liberty21Jdk8 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "8-openj9")
class Liberty21Jdk8Openj9 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "11")
class Liberty21Jdk11 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "11-openj9")
class Liberty21Jdk11Openj9 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "17")
class Liberty21Jdk17 extends LibertySmokeTest {
}
@AppServer(version = "21.0.0.10", jdk = "16-openj9")
class Liberty21Jdk16Openj9 extends LibertySmokeTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,48 @@ class Tomcat7Jdk8 extends TomcatSmokeTest {
@AppServer(version = "7.0.109", jdk = "8-openj9")
class Tomcat7Jdk8Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "8.5.71", jdk = "8")
@AppServer(version = "8.5.72", jdk = "8")
class Tomcat8Jdk8 extends TomcatSmokeTest {
}
@AppServer(version = "8.5.71", jdk = "11")
@AppServer(version = "8.5.72", jdk = "11")
class Tomcat8Jdk11 extends TomcatSmokeTest {
}
@AppServer(version = "8.5.71", jdk = "17")
@AppServer(version = "8.5.72", jdk = "17")
class Tomcat8Jdk17 extends TomcatSmokeTest {
}
@AppServer(version = "8.5.71", jdk = "8-openj9")
@AppServer(version = "8.5.72", jdk = "8-openj9")
class Tomcat8Jdk8Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "8.5.71", jdk = "11-openj9")
@AppServer(version = "8.5.72", jdk = "11-openj9")
class Tomcat8Jdk11Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "9.0.53", jdk = "8")
@AppServer(version = "9.0.54", jdk = "8")
class Tomcat9Jdk8 extends TomcatSmokeTest {
}
@AppServer(version = "9.0.53", jdk = "11")
@AppServer(version = "9.0.54", jdk = "11")
class Tomcat9Jdk11 extends TomcatSmokeTest {
}
@AppServer(version = "9.0.53", jdk = "17")
@AppServer(version = "9.0.54", jdk = "17")
class Tomcat9Jdk17 extends TomcatSmokeTest {
}
@AppServer(version = "9.0.53", jdk = "8-openj9")
@AppServer(version = "9.0.54", jdk = "8-openj9")
class Tomcat9Jdk8Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "9.0.53", jdk = "11-openj9")
@AppServer(version = "9.0.54", jdk = "11-openj9")
class Tomcat9Jdk11Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "10.0.11", jdk = "8")
@AppServer(version = "10.0.12", jdk = "8")
class Tomcat10Jdk8 extends TomcatSmokeTest {
}
@AppServer(version = "10.0.11", jdk = "11")
@AppServer(version = "10.0.12", jdk = "11")
class Tomcat10Jdk11 extends TomcatSmokeTest {
}
@AppServer(version = "10.0.11", jdk = "17")
@AppServer(version = "10.0.12", jdk = "17")
class Tomcat10Jdk17 extends TomcatSmokeTest {
}
@AppServer(version = "10.0.11", jdk = "8-openj9")
@AppServer(version = "10.0.12", jdk = "8-openj9")
class Tomcat10Jdk8Openj9 extends TomcatSmokeTest {
}
@AppServer(version = "10.0.11", jdk = "11-openj9")
@AppServer(version = "10.0.12", jdk = "11-openj9")
class Tomcat10Jdk11Openj9 extends TomcatSmokeTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.smoketest

import java.time.Duration

abstract class WebsphereSmokeTest extends AppServerTest {

protected String getTargetImagePrefix() {
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-websphere"
}

@Override
protected TargetWaitStrategy getWaitStrategy() {
return new TargetWaitStrategy.Log(Duration.ofMinutes(3), ".*Server server1 open for e-business.*")
}

@Override
protected String getSpanName(String path) {
switch (path) {
case "/app/hello.txt":
case "/app/file-that-does-not-exist":
return "HTTP GET"
}
return super.getSpanName(path)
}

@Override
boolean testRequestOutsideDeployedApp() {
false
}
}

@AppServer(version = "8.5.5.20", jdk = "8-openj9")
class Websphere8Jdk8Openj9 extends WebsphereSmokeTest {
}
@AppServer(version = "9.0.5.9", jdk = "8-openj9")
class Websphere9Jdk8Openj9 extends WebsphereSmokeTest {
}
Loading

0 comments on commit d407ced

Please sign in to comment.