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

Add Create QueryGroup API Logic #14680

Merged
merged 20 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix unit test
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
  • Loading branch information
ruai0511 committed Aug 8, 2024
commit 1b09c34d4fec1a18f12b796604c29bb868ecc763
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void testCreateQueryGroupOverflowAllocation() {

/**
* Test case to ensure the error is thrown when we already have the max allowed number of QueryGroups, but
* we try to create another one
* we want to create another one
*/
public void testCreateQueryGroupOverflowCount() {
QueryGroup toCreate = builder().name(NAME_NONE_EXISTED)
Expand All @@ -133,4 +133,16 @@ public void testCreateQueryGroupOverflowCount() {
);
assertThrows(RuntimeException.class, () -> queryGroupPersistenceService1.saveQueryGroupInClusterState(toCreate, clusterState));
}

public void testInvalidMaxQueryGroupCount() {
Settings settings = Settings.builder().put(QUERY_GROUP_COUNT_SETTING_NAME, 2).build();
ClusterSettings clusterSettings = new ClusterSettings(settings, clusterSettingsSet());
ClusterService clusterService = new ClusterService(settings, clusterSettings, mock(ThreadPool.class));
QueryGroupPersistenceService queryGroupPersistenceService = new QueryGroupPersistenceService(
clusterService,
settings,
clusterSettings
);
assertThrows(IllegalArgumentException.class, () -> queryGroupPersistenceService.setMaxQueryGroupCount(-1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void testToXContent() throws IOException {
queryGroupMetadata.toXContent(builder, null);
builder.endObject();
assertEquals(
"{\"ajakgakg983r92_4242\":{\"_id\":\"ajakgakg983r92_4242\",\"name\":\"test\",\"resiliency_mode\":\"enforced\",\"updatedAt\":1720047207,\"resourceLimits\":{\"memory\":0.5}}}",
"{\"ajakgakg983r92_4242\":{\"_id\":\"ajakgakg983r92_4242\",\"name\":\"test\",\"resiliency_mode\":\"enforced\",\"updated_at\":1720047207,\"resource_limits\":{\"memory\":0.5}}}",
builder.toString()
);
}
Expand Down