Skip to content

Commit

Permalink
Output of integration tests cleaned.
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Soszynski <[email protected]>
  • Loading branch information
lukasz-soszynski-eliatra committed Sep 5, 2022
1 parent cb5418e commit 26405c4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ sourceSets {
task integrationTest(type: Test) {
description = 'Run integration tests.'
group = 'verification'
systemProperty "org.opensearch.common.logging.NodeAndClusterIdConverter.enabled", "false"
systemProperty "java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath

Expand Down Expand Up @@ -423,6 +425,8 @@ dependencies {
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
integrationTestImplementation 'commons-io:commons-io:2.11.0'
integrationTestImplementation 'org.apache.logging.log4j:log4j-core:2.17.1'
integrationTestImplementation 'org.apache.logging.log4j:log4j-jul:2.17.1'
integrationTestImplementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.1'
integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public class SecurityRolesTests {

@Test
public void testSecurityRoles() throws Exception {

try (TestRestClient client = cluster.getRestClient(USER_SR)) {
HttpResponse response = client.getAuthInfo();
assertThat(response.getStatusCode(), equalTo(HttpStatus.SC_OK));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ private Settings getMinimalOpenSearchSettings() {
.put("discovery.probe.connect_timeout", "10s").put("discovery.probe.handshake_timeout", "10s").put("http.cors.enabled", true)
.put("plugins.security.compliance.salt", "1234567890123456")
.put("plugins.security.audit.type", "noop")
.put("gateway.auto_import_dangling_indices", "true")
.build();
}

Expand Down
6 changes: 6 additions & 0 deletions src/integrationTest/resources/log4j2-test.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
status = info
name = Integration test logging configuration



appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %threadName %-5p %c{1}:%L - %m%n
appender.console.filter.prerelease.type=RegexFilter
appender.console.filter.prerelease.regex=.+\\Qis a pre-release version of OpenSearch and is not suitable for production\\E
appender.console.filter.prerelease.onMatch=DENY
appender.console.filter.prerelease.onMismatch=NEUTRAL

rootLogger.level = warn
rootLogger.appenderRef.stdout.ref = consoleLogger
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.logging.log4j.Logger;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.EventBusBuilder;
import org.greenrobot.eventbus.Logger.JavaLogger;

import org.opensearch.client.Client;
import org.opensearch.common.settings.Settings;
Expand Down Expand Up @@ -120,7 +121,7 @@ public final static SecurityDynamicConfiguration<?> addStatics(SecurityDynamicCo
protected final Logger log = LogManager.getLogger(this.getClass());
private final ConfigurationRepository cr;
private final AtomicBoolean initialized = new AtomicBoolean();
private final EventBus eventBus = EVENT_BUS_BUILDER.build();
private final EventBus eventBus = EVENT_BUS_BUILDER.logger(new JavaLogger(DynamicConfigFactory.class.getCanonicalName())).build();
private final Settings opensearchSettings;
private final Path configPath;
private final InternalAuthenticationBackend iab = new InternalAuthenticationBackend();
Expand Down

0 comments on commit 26405c4

Please sign in to comment.