Fix rocketmq latest dep test (#8756)
This commit is contained in:
parent
7d1a271d25
commit
a1ccaad76c
|
@ -25,4 +25,8 @@ tasks.withType<Test>().configureEach {
|
||||||
jvmArgs("-Dotel.instrumentation.rocketmq-client.experimental-span-attributes=true")
|
jvmArgs("-Dotel.instrumentation.rocketmq-client.experimental-span-attributes=true")
|
||||||
|
|
||||||
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
|
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
|
||||||
|
|
||||||
|
// required on jdk17
|
||||||
|
jvmArgs("--add-opens=java.base/sun.nio.ch=ALL-UNNAMED")
|
||||||
|
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,7 @@ dependencies {
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
tasks.withType<Test>().configureEach {
|
||||||
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
|
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
|
||||||
|
// required on jdk17
|
||||||
|
jvmArgs("--add-opens=java.base/sun.nio.ch=ALL-UNNAMED")
|
||||||
|
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package io.opentelemetry.instrumentation.rocketmqclient.v4_8.base;
|
package io.opentelemetry.instrumentation.rocketmqclient.v4_8.base;
|
||||||
|
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static org.awaitility.Awaitility.await;
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils;
|
import io.opentelemetry.instrumentation.test.utils.PortUtils;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -15,6 +16,7 @@ import java.lang.reflect.Method;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -147,13 +149,23 @@ public final class IntegrationTestBase {
|
||||||
Class<?> mqAdmin = Class.forName("org.apache.rocketmq.test.util.MQAdminTestUtils");
|
Class<?> mqAdmin = Class.forName("org.apache.rocketmq.test.util.MQAdminTestUtils");
|
||||||
Method createTopic =
|
Method createTopic =
|
||||||
mqAdmin.getMethod(
|
mqAdmin.getMethod(
|
||||||
"createTopic", String.class, String.class, String.class, int.class, Map.class);
|
"createTopic",
|
||||||
createTopic.invoke(null, nsAddr, clusterName, topic, 20, emptyMap());
|
String.class,
|
||||||
} catch (ClassNotFoundException
|
String.class,
|
||||||
| InvocationTargetException
|
String.class,
|
||||||
| NoSuchMethodException
|
int.class,
|
||||||
| IllegalAccessException ex) {
|
Map.class,
|
||||||
throw new LinkageError("Could not initialize topic", ex);
|
int.class);
|
||||||
|
await()
|
||||||
|
.atMost(Duration.ofSeconds(30))
|
||||||
|
.ignoreException(InvocationTargetException.class)
|
||||||
|
.until(
|
||||||
|
() -> {
|
||||||
|
createTopic.invoke(null, nsAddr, clusterName, topic, 20, emptyMap(), 3);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
} catch (ClassNotFoundException | NoSuchMethodException ex) {
|
||||||
|
throw new IllegalStateException("Could not initialize topic", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue