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

New test framework #1967

Merged
merged 47 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1efe734
New test framework
nibix Jul 26, 2022
c3ae9a6
removed abstract base class, prefer composition over inheritance
jochenkressin Aug 1, 2022
6db0e64
moved Jackson dependencies from test classes to TestRestClient
jochenkressin Aug 1, 2022
1fa6c0a
removed unused code, replaced some old ES references
jochenkressin Aug 1, 2022
895e396
replaced JUnit asserts with Hamcrest asserts
jochenkressin Aug 1, 2022
b4cf9e9
renamed ClusterConfiguration to ClusterManager
jochenkressin Aug 1, 2022
c79c68e
throw exception if index already exists
jochenkressin Aug 2, 2022
8f94acf
fixed incorrect test
jochenkressin Aug 2, 2022
f1cef31
fixed code hygiene issues
jochenkressin Aug 2, 2022
6f4dae9
TestRestClient uses unchecked exceptions
lukasz-soszynski-eliatra Aug 8, 2022
bbf5dc9
List of plugins in ClusterManager is immutable.
lukasz-soszynski-eliatra Aug 8, 2022
0289749
Unused and overloaded version of user method removed from LocalCluste…
lukasz-soszynski-eliatra Aug 9, 2022
f81ccc4
Unused constructor removed from class ContextHeaderDecoratorClient
lukasz-soszynski-eliatra Aug 9, 2022
3e6179f
fix build.gradle - new test configuration, dependencies, desable forb…
kt-eliatra Aug 8, 2022
f373131
Try with resources was used to close OpenSearch clinet in the LocalCl…
lukasz-soszynski-eliatra Aug 10, 2022
d135827
TestCertificates - throw RuntimeException instead of IOException
kt-eliatra Aug 11, 2022
69dfa18
Nodes objects are stored in one list (instead of four) in class Local…
lukasz-soszynski-eliatra Aug 11, 2022
9c1a35d
OpenSearch claster is stopped immediatly, without invocations of thre…
lukasz-soszynski-eliatra Aug 11, 2022
26f098b
rename newTest to integrationTest
kt-eliatra Aug 11, 2022
69e3d31
Method org.opensearch.test.framework.cluster.LocalOpenSearchCluster.N…
lukasz-soszynski-eliatra Aug 11, 2022
216153e
Method org.opensearch.test.framework.cluster.LocalCluster.Builder#nod…
lukasz-soszynski-eliatra Aug 11, 2022
85f599f
Method getUnitTestForkNumber removed, system property forkno is no lo…
lukasz-soszynski-eliatra Aug 11, 2022
c32984e
ClusterBlockException does not appear in the course of integration te…
lukasz-soszynski-eliatra Aug 16, 2022
5b22c51
Unused code related to flag trackResources removed from class TestRes…
lukasz-soszynski-eliatra Aug 16, 2022
075adfa
Redundant code in method org.opensearch.test.framework.cluster.LocalC…
lukasz-soszynski-eliatra Aug 16, 2022
f217c35
Rename from ClusterConfiguration to ClusterManager finished.
lukasz-soszynski-eliatra Aug 16, 2022
65df948
Correction in class MinimumSecuritySettingsSupplierFactory to pass ch…
lukasz-soszynski-eliatra Aug 17, 2022
ea4251c
Netty dependencies conflict resolved
lukasz-soszynski-eliatra Aug 17, 2022
237a49b
change version of commons-io:commons-io for test and integrationTest
kt-eliatra Aug 19, 2022
c0b23d2
Word master replaced with cluster manager in method and local variabl…
lukasz-soszynski-eliatra Aug 19, 2022
9f6a60c
Method LocalOpenSearchCluster#stop simplified.
lukasz-soszynski-eliatra Aug 19, 2022
a418b64
integrationTest - upgrade org.hamcrest:hamcrest to 2.2
kt-eliatra Aug 23, 2022
5340d9a
add tests for SocketUtils class
kt-eliatra Aug 23, 2022
e2c66c9
add new line to SocketUtilsTests class
kt-eliatra Aug 23, 2022
777096e
add separate spotless configuration for integrationTest
kt-eliatra Aug 24, 2022
652af5b
integrationTest - apply spotless formatting
kt-eliatra Aug 24, 2022
df0da3c
CI/CD - run integrationTest task only when test task is executed
kt-eliatra Aug 24, 2022
9f4d715
Removed uses of NestedValueMap and replaced by ToXContent
nibix Aug 25, 2022
33f35f5
Fixed imports
nibix Aug 25, 2022
f1bce59
Modify defaults to prevent warnings from being added to the test output
peternied Aug 25, 2022
33b78b3
Replace non-inclusive terms from configuration settings
peternied Aug 25, 2022
674be40
Output of integration tests cleaned.
lukasz-soszynski-eliatra Aug 30, 2022
0757c08
Added API docs
nibix Sep 6, 2022
08d6500
Applied spotless rules
nibix Sep 6, 2022
67b5446
A temporary solution to limit the number of warning messages caused b…
lukasz-soszynski-eliatra Sep 13, 2022
6e5e885
Fixed license headers
nibix Sep 13, 2022
9fdb73a
Correction after code review, removed some comments and one javadoc a…
lukasz-soszynski-eliatra Sep 19, 2022
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
Prev Previous commit
Next Next commit
Output of integration tests cleaned.
Signed-off-by: Lukasz Soszynski <[email protected]>
  • Loading branch information
lukasz-soszynski-eliatra committed Sep 13, 2022
commit 674be407d9f587df36a3f29de539448edd7da194
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) {
peternied marked this conversation as resolved.
Show resolved Hide resolved
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, why do dependencies need to be repeated for integrationTestImplementation if we already have an entry for testImplementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the goal of the project is the replacement of large parts of the old legacy tests, we want to keep the test definitions as separate as possible.

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