Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ protected Map<String, String> getJobParameterAsMap(String jobId, SampleJobParame
@SuppressWarnings("unchecked")
protected SampleJobParameter getJobParameter(RestClient client, String jobId) throws IOException {
Request request = new Request("POST", "/" + SampleExtensionPlugin.JOB_INDEX_NAME + "/_search");
String entity = "{\n"
+ " \"query\": {\n"
+ " \"match\": {\n"
+ " \"_id\": {\n"
+ " \"query\": \""
+ jobId
+ "\"\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}";
String entity = """
{
"query": {
"match": {
"_id": {
"query": "%s"
}
}
}
}
""".formatted(jobId);
request.setJsonEntity(entity);
Response response = client.performRequest(request);
Map<String, Object> responseJson = JsonXContent.jsonXContent.createParser(
Expand Down Expand Up @@ -323,7 +323,14 @@ protected void deleteTestIndex(String index) throws IOException {
}

protected long countRecordsInTestIndex(String index) throws IOException {
String entity = "{\n" + " \"query\": {\n" + " \"match_all\": {\n" + " }\n" + " }\n" + "}";
String entity = """
{
"query": {
"match_all": {
}
}
}
""";
Response response = makeRequest(
client(),
"POST",
Expand Down Expand Up @@ -402,17 +409,17 @@ protected long waitAndCountRecords(String index, long waitForInMs) throws Except

@SuppressWarnings("unchecked")
protected long getLockTimeByJobId(String jobId) throws IOException {
String entity = "{\n"
+ " \"query\": {\n"
+ " \"match\": {\n"
+ " \"job_id\": {\n"
+ " \"query\": \""
+ jobId
+ "\"\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}";
String entity = """
{
"query": {
"match": {
"job_id": {
"query": "%s"
}
}
}
}
""".formatted(jobId);
Response response = makeRequest(
client(),
"POST",
Expand All @@ -435,17 +442,17 @@ protected long getLockTimeByJobId(String jobId) throws IOException {

@SuppressWarnings("unchecked")
protected boolean doesLockExistByLockTime(long lockTime) throws IOException {
String entity = "{\n"
+ " \"query\": {\n"
+ " \"match\": {\n"
+ " \"lock_time\": {\n"
+ " \"query\": "
+ lockTime
+ "\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}";
String entity = """
{
"query": {
"match": {
"lock_time": {
"query": %d
}
}
}
}
""".formatted(lockTime);
Response response = makeRequest(
client(),
"POST",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,25 @@
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.SUITE, numDataNodes = 2)
public class GetJobDetailsMultiNodeRestIT extends ODFERestTestCase {

private static final String initialRequestBody =
"{\"job_index\":\"intial_job_index\",\"job_type\":\"intial_job_type\",\"job_parameter_action\":\"intial_job_parameter_action\",\"job_runner_action\":\"intial_job_runner_action\",\"extension_unique_id\":\"extension_unique_id\"}";
private static final String updatedRequestBody =
"{\"job_index\":\"updated_job_index\",\"job_type\":\"updated_job_type\",\"job_parameter_action\":\"updated_job_parameter_action\",\"job_runner_action\":\"updated_job_runner_action\",\"extension_unique_id\":\"extension_unique_id\"}";
private static final String initialRequestBody = """
{
"job_index": "intial_job_index",
"job_type": "intial_job_type",
"job_parameter_action": "intial_job_parameter_action",
"job_runner_action": "intial_job_runner_action",
"extension_unique_id": "extension_unique_id"
}
""";

private static final String updatedRequestBody = """
{
"job_index": "updated_job_index",
"job_type": "updated_job_type",
"job_parameter_action": "updated_job_parameter_action",
"job_runner_action": "updated_job_runner_action",
"extension_unique_id": "extension_unique_id"
}
""";

/**
* The below test performs a get index api on a multinode cluster. Internally, the cluster redirects the request to either of the node.
Expand Down
Loading