Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert module apache-dubbo-2.7 test case from groovy to java #12008

Merged
merged 28 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
060c9c4
convert module apache-dubbo-2.7 test case from groovy to java
shalk Aug 14, 2024
6085bcc
fix compile error
shalk Aug 14, 2024
855291b
fix ut
shalk Aug 14, 2024
ff776e0
fix ut class
shalk Aug 14, 2024
33790bb
fix ut fail
shalk Aug 15, 2024
051d877
fix some ut fail with dubbo 3.2.15
shalk Aug 15, 2024
f3c6b5c
fix more ut problem
shalk Aug 16, 2024
deef59c
add comments
shalk Aug 16, 2024
0a0c324
Update AbstractDubboTraceChainTest.java
shalk Aug 17, 2024
e2f880b
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
7bf8fe6
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
5c21117
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
1449213
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
7a4ffbd
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
bf2da2a
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
538ebf6
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
f9d90d3
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
99455e9
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
c4ccf1a
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
a15a868
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
b394429
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
7abd7b5
Update instrumentation/apache-dubbo-2.7/testing/src/main/java/io/open…
shalk Aug 19, 2024
a4ba31d
fix compile warn
shalk Aug 19, 2024
3d6fe13
use setUp/tearDown
shalk Aug 26, 2024
b6f5cfd
revert dubbo build.gradle.kts
shalk Aug 27, 2024
85878d7
refine ut suppresswarning and cleanup
shalk Sep 2, 2024
dba1658
fix SuppressWarnings
shalk Sep 3, 2024
f29c195
fix cleanup
shalk Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 6 additions & 28 deletions instrumentation/apache-dubbo-2.7/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,17 @@ muzzle {
assertInverse.set(true)
}
}
// The testing module use `class DubboBootstrap` which is since 2.7.5, the ut will fail for 2.7.0
// so we only test it on (2.7.5,)
val apacheDubboVersion = "2.7.5"
laurit marked this conversation as resolved.
Show resolved Hide resolved

dependencies {
implementation(project(":instrumentation:apache-dubbo-2.7:library-autoconfigure"))

library("org.apache.dubbo:dubbo:2.7.0")
}

val latestDepTest = findProperty("testLatestDeps") as Boolean
library("org.apache.dubbo:dubbo:$apacheDubboVersion")

testing {
suites {
// using a test suite to ensure that project(":instrumentation:apache-dubbo-2.7:library-autoconfigure")
// is not available on test runtime class path, otherwise instrumentation from library-autoconfigure
// module would be used instead of the javaagent instrumentation that we want to test
val testDubbo by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:apache-dubbo-2.7:testing"))
if (latestDepTest) {
implementation("org.apache.dubbo:dubbo:+")
implementation("org.apache.dubbo:dubbo-config-api:+")
} else {
implementation("org.apache.dubbo:dubbo:2.7.0")
implementation("org.apache.dubbo:dubbo-config-api:2.7.0")
}
}
}
}
laurit marked this conversation as resolved.
Show resolved Hide resolved
testImplementation(project(":instrumentation:apache-dubbo-2.7:testing"))
testLibrary("org.apache.dubbo:dubbo-config-api:$apacheDubboVersion")
}

tasks.withType<Test>().configureEach {
Expand All @@ -46,9 +30,3 @@ tasks.withType<Test>().configureEach {
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
}

tasks {
check {
dependsOn(testing.suites)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.apachedubbo.v2_7;

import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import org.junit.jupiter.api.extension.RegisterExtension;

class DubboAgentTest extends AbstractDubboTest {

@RegisterExtension
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
InstrumentationExtension testing() {
return testing;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.apachedubbo.v2_7;

import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import org.junit.jupiter.api.extension.RegisterExtension;

class DubboAgentTraceChainTest extends AbstractDubboTraceChainTest {

@RegisterExtension
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
InstrumentationExtension testing() {
return testing;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
plugins {
id("otel.library-instrumentation")
}
val apacheDubboVersion = "2.7.5"

dependencies {
compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")

library("org.apache.dubbo:dubbo:2.7.0")
library("org.apache.dubbo:dubbo:$apacheDubboVersion")

testImplementation(project(":instrumentation:apache-dubbo-2.7:testing"))

testLibrary("org.apache.dubbo:dubbo-config-api:2.7.0")
testLibrary("org.apache.dubbo:dubbo-config-api:$apacheDubboVersion")
}

tasks.withType<Test>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ enum DubboHeadersGetter implements TextMapGetter<DubboRequest> {
INSTANCE;

@Override
@SuppressWarnings("deprecation") // deprecation for dubbo 3.2.15
public Iterable<String> keys(DubboRequest request) {
return request.invocation().getAttachments().keySet();
}

@Override
@SuppressWarnings("deprecation") // deprecation for dubbo 3.2.15
public String get(DubboRequest request, String key) {
return request.invocation().getAttachment(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final class TracingFilter implements Filter {
}

@Override
@SuppressWarnings("deprecation") // deprecation for RpcContext.getContext()
public Result invoke(Invoker<?> invoker, Invocation invocation) {
if (!(invocation instanceof RpcInvocation)) {
return invoker.invoke(invocation);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.apachedubbo.v2_7;

import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
import org.junit.jupiter.api.extension.RegisterExtension;

class DubboTest extends AbstractDubboTest {

@RegisterExtension
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
InstrumentationExtension testing() {
return testing;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.apachedubbo.v2_7;

import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
import org.junit.jupiter.api.extension.RegisterExtension;

class DubboTraceChainTest extends AbstractDubboTraceChainTest {

@RegisterExtension
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
InstrumentationExtension testing() {
return testing;
}
}
Loading
Loading