Skip to content

Commit

Permalink
Use trace logging for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Sep 5, 2024
1 parent 30d5e8e commit f49a492
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 180 deletions.
8 changes: 0 additions & 8 deletions CreateSnapshot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import org.opensearch.migrations.common.CommonUtils
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

dependencies {
implementation project(":commonDependencyVersionConstraints")

Expand All @@ -27,7 +23,3 @@ dependencies {
application {
mainClassName = 'com.rfs.CreateSnapshot'
}

test {
useJUnitPlatform()
}
4 changes: 0 additions & 4 deletions DocumentsFromSnapshotMigration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ class DockerServiceProps {
List<String> taskDependencies = []
}

repositories {
mavenCentral()
}

dependencies {
implementation project(":commonDependencyVersionConstraints")
implementation platform('io.projectreactor:reactor-bom:2023.0.5')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ appender.console.layout.pattern = %d{HH:mm:ss.SSS} %threadName %-5p %c{1}:%L - %
rootLogger.level = info
rootLogger.appenderRef.console.ref = Console

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = com.rfs,org.opensearch.migrations
logger.Migrations.level = trace

logger.wireLogger.name = org.apache.http.wire
logger.wireLogger.level = OFF
logger.wireLogger.additivity = false
4 changes: 0 additions & 4 deletions MetadataMigration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ plugins {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

dependencies {
implementation project(":commonDependencyVersionConstraints")

Expand Down
11 changes: 3 additions & 8 deletions MetadataMigration/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ appender.console.layout.pattern = %m%n
rootLogger.level = info
rootLogger.appenderRef.console.ref = Console

logger.rfs.name = com.rfs
logger.rfs.level = debug

logger.migrations.name = com.opensearch.migrations
logger.migrations.level = debug

logger.transformer.name = com.rfs.transformers.Transformer_ES_6_8_to_OS_2_11
logger.transformer.level = debug
# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = com.rfs,org.opensearch.migrations
logger.Migrations.level = trace

# Lower the logging level on these other systems
logger.wire.name = org.apache.hc.client5.http
Expand Down
5 changes: 0 additions & 5 deletions RFS/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ plugins {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11


repositories {
mavenCentral()
}

ext {
awsSdkVersion = '2.25.16'
dataset = findProperty('dataset') ?: 'skip_dataset'
Expand Down
6 changes: 4 additions & 2 deletions RFS/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss.SSS} %threadName %-5p %c{1}:%L - %m%n

# Logger definitions
logger.rfs.name = com.rfs
logger.rfs.level = debug

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = com.rfs,org.opensearch.migrations
logger.Migrations.level = trace

logger.wire.name = org.apache.hc.client5.http
logger.wire.level = info
Expand Down
31 changes: 0 additions & 31 deletions TrafficCapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ plugins {
id 'org.owasp.dependencycheck' version '8.2.1'
}

allprojects {
repositories {
mavenCentral()
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
Expand Down Expand Up @@ -37,29 +31,4 @@ allprojects {
languageVersion = JavaLanguageVersion.of(11)
}
}

tasks.withType(Test) {
// Getting javadoc to compile is part of the test suite to ensure we are able to publish our artifacts
dependsOn project.javadoc

// Provide way to exclude particular tests from CLI
// e.g. ../gradlew test -PexcludeTests=**/KafkaProtobufConsumerLongTermTest*
if (project.hasProperty('excludeTests')) {
exclude project.property('excludeTests')
}
useJUnitPlatform {
// Disable parallel test execution, see MIGRATIONS-1666
systemProperty 'junit.jupiter.execution.parallel.enabled', 'false'
}
systemProperty 'log4j2.contextSelector', 'org.apache.logging.log4j.core.selector.BasicContextSelector'
jvmArgs '-ea'
}

tasks.named('test') {
systemProperty 'disableMemoryLeakTests', 'true'
}

tasks.named('slowTest') {
systemProperty 'disableMemoryLeakTests', 'false'
}
}
4 changes: 0 additions & 4 deletions TrafficCapture/captureKafkaOffloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ plugins {
id 'io.freefair.lombok'
}

repositories {
mavenCentral()
}

dependencies {
api project(":commonDependencyVersionConstraints")
implementation project(':TrafficCapture:captureOffloader')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
status = error

# Root logger options
rootLogger.level = debug
rootLogger.level = info
rootLogger.appenderRef.console.ref = Console

# Console appender configuration
appender.console.type = Console
appender.console.name = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} %p %c{1.} [%t] %m%equals{ ctx=%mdc}{ ctx=\{\}}{}%n

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = org.opensearch.migrations
logger.Migrations.level = trace
4 changes: 0 additions & 4 deletions TrafficCapture/captureOffloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ plugins {
id 'java-test-fixtures'
}

repositories {
mavenCentral()
}

sourceSets {
main {
java {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
status = error

# Root logger options
rootLogger.level = debug
rootLogger.level = info
rootLogger.appenderRef.console.ref = Console

# Console appender configuration
appender.console.type = Console
appender.console.name = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} %p %c{1.} [%t] %m%equals{ ctx=%mdc}{ ctx=\{\}}{}%n

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = org.opensearch.migrations
logger.Migrations.level = trace
4 changes: 0 additions & 4 deletions TrafficCapture/captureProtobufs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ plugins {
id 'com.google.protobuf' version "0.9.2"
}

repositories {
mavenCentral()
}

dependencies {
api project(":commonDependencyVersionConstraints")
api group: 'com.google.protobuf', name: 'protobuf-java', version: '3.22.2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
status = error

rootLogger.level = debug
rootLogger.level = info

appender.console.type = Console
appender.console.name = STDERR
Expand All @@ -9,3 +9,7 @@ appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} [%t] %c{1} - %msg%equals{ ctx=%mdc}{ ctx=\{\}}{}%n

rootLogger.appenderRef.stderr.ref = STDERR

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = org.opensearch.migrations
logger.Migrations.level = trace
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ appender.console.target = SYSTEM_ERR
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} [%t] %c{1} - %msg%equals{ ctx=%mdc}{ ctx=\{\}}{}%n

rootLogger.level = debug
rootLogger.level = info
rootLogger.appenderRefs = stderr
rootLogger.appenderRef.stderr.ref = STDERR

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = org.opensearch.migrations
logger.Migrations.level = trace
4 changes: 0 additions & 4 deletions TrafficCapture/trafficReplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ plugins {
id 'java-test-fixtures'
}

repositories {
mavenCentral()
}

dependencies {
implementation project(":commonDependencyVersionConstraints")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected Map<String, Object> createMap() {
*/
public Object consumeByteBuffer(ByteBuffer byteBuffer) throws IOException {
ByteBufferFeeder feeder = (ByteBufferFeeder) parser.getNonBlockingInputFeeder();
log.trace("Consuming bytes: " + byteBuffer.toString());
feeder.feedInput(byteBuffer);

while (!parser.isClosed()) {
Expand All @@ -58,8 +57,6 @@ public Object consumeByteBuffer(ByteBuffer byteBuffer) throws IOException {
// pipeline stall - need more data
break;
}

log.trace(this + " ... adding token=" + token);
switch (token) {
case FIELD_NAME:
jsonObjectStack.push(parser.getText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} %p %c{1.} [%t
# of the logs for tests
logger.OutputTupleJsonLogger.name = OutputTupleJsonLogger
logger.OutputTupleJsonLogger.level = OFF

# Tracing logger for migration packages to test trace logging code flows
logger.Migrations.name = org.opensearch.migrations
logger.Migrations.level = trace
6 changes: 1 addition & 5 deletions TrafficCapture/transformationPlugins/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
subprojects {
repositories {
mavenCentral()
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ plugins {
id 'io.freefair.lombok'
}

repositories {
mavenCentral()
}

dependencies {
api project(":commonDependencyVersionConstraints")
}

tasks.named('test') {
useJUnitPlatform()
}
4 changes: 0 additions & 4 deletions awsUtilities/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ plugins {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

dependencies {
api project(":commonDependencyVersionConstraints")

Expand Down
Loading

0 comments on commit f49a492

Please sign in to comment.