Skip to content

Commit

Permalink
Merge branch '2.x' into backport/backport-6694-to-2.x
Browse files Browse the repository at this point in the history
Signed-off-by: Sarat Vemulapalli <[email protected]>
  • Loading branch information
saratvemulapalli committed Mar 22, 2023
2 parents a8ca84d + 7ea7792 commit e2c29ae
Show file tree
Hide file tree
Showing 162 changed files with 1,485 additions and 1,417 deletions.
1 change: 1 addition & 0 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ BWC_VERSION:
- "1.3.7"
- "1.3.8"
- "1.3.9"
- "1.3.10"
- "2.0.0"
- "2.0.1"
- "2.0.2"
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/github-merit-badger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: github-merit-badger
on:
pull_request_target:
types:
- opened

jobs:
call-action:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: aws-github-ops/[email protected]
id: merit-badger
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
badges: '[first-time-contributor,repeat-contributor,valued-contributor,seasoned-contributor,all-star-contributor,distinguished-contributor]'
thresholds: '[0,3,6,13,25,50]'
badge-type: 'achievement'
ignore-usernames: '[opensearch-ci-bot, dependabot, opensearch-trigger-bot]'
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `net.minidev:json-smart` from 2.4.8 to 2.4.9
- Bump `com.google.protobuf:protobuf-java` from 3.22.0 to 3.22.2
- Bump Netty to 4.1.90.Final ([#6677](https://github.com/opensearch-project/OpenSearch/pull/6677)
- Bump `com.diffplug.spotless` from 6.15.0 to 6.17.0
- Bump `org.apache.zookeeper:zookeeper` from 3.8.0 to 3.8.1
- Bump `net.minidev:json-smart` from 2.4.7 to 2.4.10
- Bump `org.apache.maven:maven-model` from 3.6.2 to 3.9.1

### Changed
- Require MediaType in Strings.toString API ([#6009](https://github.com/opensearch-project/OpenSearch/pull/6009))
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ plugins {
id 'lifecycle-base'
id 'opensearch.docker-support'
id 'opensearch.global-build-info'
id "com.diffplug.spotless" version "6.15.0" apply false
id "com.diffplug.spotless" version "6.17.0" apply false
id "org.gradle.test-retry" version "1.5.1" apply false
id "test-report-aggregation"
id 'jacoco-report-aggregation'
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ dependencies {
api 'de.thetaphi:forbiddenapis:3.4'
api 'com.avast.gradle:gradle-docker-compose-plugin:0.16.11'
api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}"
api 'org.apache.maven:maven-model:3.6.2'
api 'org.apache.maven:maven-model:3.9.1'
api 'com.networknt:json-schema-validator:1.0.73'
api "com.fasterxml.jackson.core:jackson-databind:${props.getProperty('jackson_databind')}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ public void apply(Project project) {

Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle()
.getSharedServices()
.registerIfAbsent(
DOCKER_SUPPORT_SERVICE_NAME,
DockerSupportService.class,
spec -> spec.parameters(
params -> { params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE)); }
)
);
.registerIfAbsent(DOCKER_SUPPORT_SERVICE_NAME, DockerSupportService.class, spec -> spec.parameters(params -> {
params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE));
}));

// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists
project.getGradle().getTaskGraph().whenReady(graph -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ public InternalDistributionBwcSetupPlugin(ProviderFactory providerFactory) {
@Override
public void apply(Project project) {
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
BuildParams.getBwcVersions()
.forPreviousUnreleased(
(BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath), unreleasedVersion);
}
);
BuildParams.getBwcVersions().forPreviousUnreleased((BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath), unreleasedVersion);
});
}

private void configureBwcProject(Project project, BwcVersions.UnreleasedVersionInfo versionInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,9 @@ public void apply(Project project) {

// windows boxes get windows distributions, and linux boxes get linux distributions
if (isWindows(vmProject)) {
configureVMWrapperTasks(
vmProject,
windowsTestTasks,
depsTasks,
wrapperTask -> { vmLifecyleTasks.get(OpenSearchDistribution.Type.ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); },
vmDependencies
);
configureVMWrapperTasks(vmProject, windowsTestTasks, depsTasks, wrapperTask -> {
vmLifecyleTasks.get(OpenSearchDistribution.Type.ARCHIVE).configure(t -> t.dependsOn(wrapperTask));
}, vmDependencies);
} else {
for (Entry<OpenSearchDistribution.Type, List<TaskProvider<Test>>> entry : linuxTestTasks.entrySet()) {
OpenSearchDistribution.Type type = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public class MainResponse {
private static final ConstructingObjectParser<MainResponse, Void> PARSER = new ConstructingObjectParser<>(
MainResponse.class.getName(),
true,
args -> { return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3]); }
args -> {
return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3]);
}
);

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ public static final class FieldStatistics {
private static final ConstructingObjectParser<FieldStatistics, Void> PARSER = new ConstructingObjectParser<>(
"field_statistics",
true,
args -> { return new FieldStatistics((long) args[0], (int) args[1], (long) args[2]); }
args -> {
return new FieldStatistics((long) args[0], (int) args[1], (long) args[2]);
}
);

static {
Expand Down Expand Up @@ -411,11 +413,9 @@ public int hashCode() {

public static final class Token {

private static final ConstructingObjectParser<Token, Void> PARSER = new ConstructingObjectParser<>(
"token",
true,
args -> { return new Token((Integer) args[0], (Integer) args[1], (Integer) args[2], (String) args[3]); }
);
private static final ConstructingObjectParser<Token, Void> PARSER = new ConstructingObjectParser<>("token", true, args -> {
return new Token((Integer) args[0], (Integer) args[1], (Integer) args[2], (String) args[3]);
});
static {
PARSER.declareInt(optionalConstructorArg(), new ParseField("start_offset"));
PARSER.declareInt(optionalConstructorArg(), new ParseField("end_offset"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,9 @@ public void testIndex() throws IOException {
assertEquals("index", indexResponse.getIndex());
assertEquals("with_create_op_type", indexResponse.getId());

OpenSearchStatusException exception = expectThrows(
OpenSearchStatusException.class,
() -> { execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync); }
);
OpenSearchStatusException exception = expectThrows(OpenSearchStatusException.class, () -> {
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
});

assertEquals(RestStatus.CONFLICT, exception.status());
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ public void testReindex() throws IOException {
reindexRequest.setRefresh(true);
reindexRequest.setRequireAlias(true);

OpenSearchStatusException exception = expectThrows(
OpenSearchStatusException.class,
() -> { execute(reindexRequest, highLevelClient()::reindex, highLevelClient()::reindexAsync); }
);
OpenSearchStatusException exception = expectThrows(OpenSearchStatusException.class, () -> {
execute(reindexRequest, highLevelClient()::reindex, highLevelClient()::reindexAsync);
});
assertEquals(RestStatus.NOT_FOUND, exception.status());
assertEquals(
"OpenSearch exception [type=index_not_found_exception, reason=no such index [dest] and [require_alias] request flag is [true] and [dest] is not an alias]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,9 @@ public void testPerformRequestOnSuccess() throws IOException {
{
IOException ioe = expectThrows(
IOException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.emptySet()
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.emptySet())
);
assertEquals(
"Unable to parse response body for Response{requestLine=GET / http/1.1, host=http://localhost:9200, "
Expand Down Expand Up @@ -575,13 +571,9 @@ public void testPerformRequestOnResponseExceptionWithIgnoresErrorNoBody() throws
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
OpenSearchException openSearchException = expectThrows(
OpenSearchException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.singleton(404)
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.singleton(404))
);
assertEquals(RestStatus.NOT_FOUND, openSearchException.status());
assertSame(responseException, openSearchException.getCause());
Expand All @@ -598,13 +590,9 @@ public void testPerformRequestOnResponseExceptionWithIgnoresErrorValidBody() thr
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
OpenSearchException openSearchException = expectThrows(
OpenSearchException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.singleton(404)
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.singleton(404))
);
assertEquals(RestStatus.NOT_FOUND, openSearchException.status());
assertSame(responseException, openSearchException.getSuppressed()[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ public void testShingleFilters() {
.build();
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);

expectThrows(
IllegalArgumentException.class,
() -> { indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers; }
);
expectThrows(IllegalArgumentException.class, () -> {
indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers;
});

}

Expand Down Expand Up @@ -308,7 +307,9 @@ public void testPreconfiguredTokenFilters() throws IOException {
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
"Expected exception for factory " + tf.getName(),
() -> { tf.get(idxSettings, null, tf.getName(), settings).getSynonymFilter(); }
() -> {
tf.get(idxSettings, null, tf.getName(), settings).getSynonymFilter();
}
);
assertEquals(tf.getName(), "Token filter [" + tf.getName() + "] cannot be used to parse synonyms", e.getMessage());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ public void testUnmapped() throws IOException {
randomPrecision(),
null,
geoGrid -> { assertEquals(0, geoGrid.getBuckets().size()); },
iw -> { iw.addDocument(Collections.singleton(new LatLonDocValuesField(FIELD_NAME, 10D, 10D))); }
iw -> {
iw.addDocument(Collections.singleton(new LatLonDocValuesField(FIELD_NAME, 10D, 10D)));
}
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ public void testThrowsFunctionsException() {
GeoIpCache cache = new GeoIpCache(1);
IllegalArgumentException ex = expectThrows(
IllegalArgumentException.class,
() -> cache.putIfAbsent(
InetAddresses.forString("127.0.0.1"),
AbstractResponse.class,
ip -> { throw new IllegalArgumentException("bad"); }
)
() -> cache.putIfAbsent(InetAddresses.forString("127.0.0.1"), AbstractResponse.class, ip -> {
throw new IllegalArgumentException("bad");
})
);
assertEquals("bad", ex.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,13 @@ public void testMegamorphic() throws Throwable {
map.put("a", "b");
assertEquals(2, (int) handle.invokeExact((Object) map));

final IllegalArgumentException iae = expectThrows(
IllegalArgumentException.class,
() -> { Integer.toString((int) handle.invokeExact(new Object())); }
);
final IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () -> {
Integer.toString((int) handle.invokeExact(new Object()));
});
assertEquals("dynamic method [java.lang.Object, size/0] not found", iae.getMessage());
assertTrue(
"Does not fail inside ClassValue.computeValue()",
Arrays.stream(iae.getStackTrace())
.anyMatch(
e -> {
return e.getMethodName().equals("computeValue")
&& e.getClassName().startsWith("org.opensearch.painless.DefBootstrap$PIC$");
}
)
);
assertTrue("Does not fail inside ClassValue.computeValue()", Arrays.stream(iae.getStackTrace()).anyMatch(e -> {
return e.getMethodName().equals("computeValue") && e.getClassName().startsWith("org.opensearch.painless.DefBootstrap$PIC$");
}));
}

// test operators with null guards
Expand Down
Loading

0 comments on commit e2c29ae

Please sign in to comment.