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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added
- Add support for Warm Indices Write Block on Flood Watermark breach ([#18375](https://github.com/opensearch-project/OpenSearch/pull/18375))
- Add support for custom index name resolver from cluster plugin ([#18593](https://github.com/opensearch-project/OpenSearch/pull/18593))
- Rename WorkloadGroupTestUtil to WorkloadManagementTestUtil ([#18709](https://github.com/opensearch-project/OpenSearch/pull/18709))
- Disallow resize for Warm Index, add Parameterized ITs for close in remote store ([#18686](https://github.com/opensearch-project/OpenSearch/pull/18686))
- Ability to run Code Coverage with Gradle and produce the jacoco reports locally ([#18509](https://github.com/opensearch-project/OpenSearch/issues/18509))
- Add NodeResourceUsageStats to ClusterInfo ([#18480](https://github.com/opensearch-project/OpenSearch/issues/18472))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

public class WorkloadGroupTestUtils {
public class WorkloadManagementTestUtils {
public static final String NAME_ONE = "workload_group_one";
public static final String NAME_TWO = "workload_group_two";
public static final String _ID_ONE = "AgfUO5Ja9yfsYlONlYi3TQ==";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.util.ArrayList;
import java.util.List;

import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.assertEqualWorkloadGroups;
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.assertEqualWorkloadGroups;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;

public class CreateWorkloadGroupRequestTests extends OpenSearchTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opensearch.core.rest.RestStatus;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
Expand All @@ -30,7 +30,7 @@ public class CreateWorkloadGroupResponseTests extends OpenSearchTestCase {
* Test case to verify serialization and deserialization of CreateWorkloadGroupResponse.
*/
public void testSerialization() throws IOException {
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupOne, RestStatus.OK);
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupOne, RestStatus.OK);
BytesStreamOutput out = new BytesStreamOutput();
response.writeTo(out);
StreamInput streamInput = out.bytes().streamInput();
Expand All @@ -42,15 +42,15 @@ public void testSerialization() throws IOException {
List<WorkloadGroup> listTwo = new ArrayList<>();
listOne.add(responseGroup);
listTwo.add(otherResponseGroup);
WorkloadGroupTestUtils.assertEqualWorkloadGroups(listOne, listTwo, false);
WorkloadManagementTestUtils.assertEqualWorkloadGroups(listOne, listTwo, false);
}

/**
* Test case to validate the toXContent method of CreateWorkloadGroupResponse.
*/
public void testToXContentCreateWorkloadGroup() throws IOException {
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupOne, RestStatus.OK);
CreateWorkloadGroupResponse response = new CreateWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupOne, RestStatus.OK);
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();
String expected = "{\n"
+ " \"_id\" : \"AgfUO5Ja9yfsYlONlYi3TQ==\",\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
Expand All @@ -22,8 +22,8 @@ public class DeleteWorkloadGroupRequestTests extends OpenSearchTestCase {
* Test case to verify the serialization and deserialization of DeleteWorkloadGroupRequest.
*/
public void testSerialization() throws IOException {
DeleteWorkloadGroupRequest request = new DeleteWorkloadGroupRequest(WorkloadGroupTestUtils.NAME_ONE);
assertEquals(WorkloadGroupTestUtils.NAME_ONE, request.getName());
DeleteWorkloadGroupRequest request = new DeleteWorkloadGroupRequest(WorkloadManagementTestUtils.NAME_ONE);
assertEquals(WorkloadManagementTestUtils.NAME_ONE, request.getName());
BytesStreamOutput out = new BytesStreamOutput();
request.writeTo(out);
StreamInput streamInput = out.bytes().streamInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
Expand All @@ -21,8 +21,8 @@ public class GetWorkloadGroupRequestTests extends OpenSearchTestCase {
* Test case to verify the serialization and deserialization of GetWorkloadGroupRequest.
*/
public void testSerialization() throws IOException {
GetWorkloadGroupRequest request = new GetWorkloadGroupRequest(WorkloadGroupTestUtils.NAME_ONE);
assertEquals(WorkloadGroupTestUtils.NAME_ONE, request.getName());
GetWorkloadGroupRequest request = new GetWorkloadGroupRequest(WorkloadManagementTestUtils.NAME_ONE);
assertEquals(WorkloadManagementTestUtils.NAME_ONE, request.getName());
BytesStreamOutput out = new BytesStreamOutput();
request.writeTo(out);
StreamInput streamInput = out.bytes().streamInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opensearch.core.rest.RestStatus;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
Expand All @@ -31,7 +31,7 @@ public class GetWorkloadGroupResponseTests extends OpenSearchTestCase {
*/
public void testSerializationSingleWorkloadGroup() throws IOException {
List<WorkloadGroup> list = new ArrayList<>();
list.add(WorkloadGroupTestUtils.workloadGroupOne);
list.add(WorkloadManagementTestUtils.workloadGroupOne);
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(list, RestStatus.OK);
assertEquals(response.getWorkloadGroups(), list);

Expand All @@ -41,15 +41,15 @@ public void testSerializationSingleWorkloadGroup() throws IOException {

GetWorkloadGroupResponse otherResponse = new GetWorkloadGroupResponse(streamInput);
assertEquals(response.getRestStatus(), otherResponse.getRestStatus());
WorkloadGroupTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
WorkloadManagementTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
}

/**
* Test case to verify the serialization and deserialization of GetWorkloadGroupResponse when the result contains multiple WorkloadGroups.
*/
public void testSerializationMultipleWorkloadGroup() throws IOException {
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(WorkloadGroupTestUtils.workloadGroupList(), RestStatus.OK);
assertEquals(response.getWorkloadGroups(), WorkloadGroupTestUtils.workloadGroupList());
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(WorkloadManagementTestUtils.workloadGroupList(), RestStatus.OK);
assertEquals(response.getWorkloadGroups(), WorkloadManagementTestUtils.workloadGroupList());

BytesStreamOutput out = new BytesStreamOutput();
response.writeTo(out);
Expand All @@ -58,7 +58,7 @@ public void testSerializationMultipleWorkloadGroup() throws IOException {
GetWorkloadGroupResponse otherResponse = new GetWorkloadGroupResponse(streamInput);
assertEquals(response.getRestStatus(), otherResponse.getRestStatus());
assertEquals(2, otherResponse.getWorkloadGroups().size());
WorkloadGroupTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
WorkloadManagementTestUtils.assertEqualWorkloadGroups(response.getWorkloadGroups(), otherResponse.getWorkloadGroups(), false);
}

/**
Expand All @@ -83,7 +83,7 @@ public void testSerializationNull() throws IOException {
*/
public void testToXContentGetSingleWorkloadGroup() throws IOException {
List<WorkloadGroup> workloadGroupList = new ArrayList<>();
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupOne);
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupOne);
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(workloadGroupList, RestStatus.OK);
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();
Expand All @@ -108,8 +108,8 @@ public void testToXContentGetSingleWorkloadGroup() throws IOException {
*/
public void testToXContentGetMultipleWorkloadGroup() throws IOException {
List<WorkloadGroup> workloadGroupList = new ArrayList<>();
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupOne);
workloadGroupList.add(WorkloadGroupTestUtils.workloadGroupTwo);
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupOne);
workloadGroupList.add(WorkloadManagementTestUtils.workloadGroupTwo);
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
GetWorkloadGroupResponse response = new GetWorkloadGroupResponse(workloadGroupList, RestStatus.OK);
String actual = response.toXContent(builder, mock(ToXContent.Params.class)).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;

import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_NONE_EXISTED;
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.clusterState;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_NONE_EXISTED;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.clusterState;
import static org.mockito.Mockito.mock;

public class TransportGetWorkloadGroupActionTests extends OpenSearchTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.HashMap;
import java.util.Map;

import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;

public class UpdateWorkloadGroupRequestTests extends OpenSearchTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import org.opensearch.core.rest.RestStatus;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.plugin.wlm.WorkloadGroupTestUtils;
import org.opensearch.plugin.wlm.WorkloadManagementTestUtils;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupOne;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.workloadGroupOne;
import static org.mockito.Mockito.mock;

public class UpdateWorkloadGroupResponseTests extends OpenSearchTestCase {
Expand All @@ -43,7 +43,7 @@ public void testSerialization() throws IOException {
List<WorkloadGroup> list2 = new ArrayList<>();
list1.add(responseGroup);
list2.add(otherResponseGroup);
WorkloadGroupTestUtils.assertEqualWorkloadGroups(list1, list2, false);
WorkloadManagementTestUtils.assertEqualWorkloadGroups(list1, list2, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.mockito.ArgumentCaptor;

import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.WorkloadManagementTestUtils.NAME_ONE;
import static org.opensearch.rest.RestRequest.Method.DELETE;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
Expand Down
Loading
Loading