Fix flaky StatementSanitizationConfigTest (#4264)
This commit is contained in:
parent
54e3cd9af0
commit
033c20a3d9
|
@ -47,4 +47,22 @@ tasks {
|
||||||
sourcesJar {
|
sourcesJar {
|
||||||
dependsOn("generateJflex")
|
dependsOn("generateJflex")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val testStatementSanitizerConfig by registering(Test::class) {
|
||||||
|
filter {
|
||||||
|
includeTestsMatching("StatementSanitizationConfigTest")
|
||||||
|
isFailOnNoMatchingTests = false
|
||||||
|
}
|
||||||
|
include("**/StatementSanitizationConfigTest.*")
|
||||||
|
jvmArgs("-Dotel.instrumentation.common.db-statement-sanitizer.enabled=false")
|
||||||
|
}
|
||||||
|
|
||||||
|
named<Test>("test") {
|
||||||
|
dependsOn(testStatementSanitizerConfig)
|
||||||
|
|
||||||
|
filter {
|
||||||
|
excludeTestsMatching("StatementSanitizationConfigTest")
|
||||||
|
isFailOnNoMatchingTests = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,12 @@ package io.opentelemetry.instrumentation.api.db;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.api.config.Config;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class StatementSanitizationConfigTest {
|
public class StatementSanitizationConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldGetFalse() {
|
void shouldGetFalse() {
|
||||||
Config config =
|
|
||||||
Config.newBuilder()
|
|
||||||
.addProperty("otel.instrumentation.common.db-statement-sanitizer.enabled", "false")
|
|
||||||
.build();
|
|
||||||
Config.internalInitializeConfig(config);
|
|
||||||
assertFalse(StatementSanitizationConfig.isStatementSanitizationEnabled());
|
assertFalse(StatementSanitizationConfig.isStatementSanitizationEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue