Skip to content

Commit

Permalink
Integration Tests Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ajay Kumar Movva <[email protected]>
  • Loading branch information
Ajay Kumar Movva committed Mar 11, 2024
1 parent b0f31ea commit 93ee481
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(settings).build();
}

public void testAdmissionControlRejectionOnEnforced() {
public void testAdmissionControlRejectionOnEnforced() throws Exception{
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames(INDEX_NAME);
String primaryName = primaryReplicaNodeNames.v1();
String replicaName = primaryReplicaNodeNames.v2();
String coordinatingOnlyNode = getCoordinatingOnlyNode();
AdmissionControlService admissionControlServicePrimary = internalCluster().getInstance(AdmissionControlService.class, primaryName);
AdmissionControlService admissionControlServiceReplica = internalCluster().getInstance(AdmissionControlService.class, replicaName);
Thread.sleep(6000);
final BulkRequest bulkRequest = new BulkRequest();
for (int i = 0; i < 3; ++i) {
IndexRequest request = new IndexRequest(INDEX_NAME).id(UUIDs.base64UUID())
Expand Down Expand Up @@ -196,10 +197,10 @@ public void testAdmissionControlRejectionOnEnforced() {
}
}

public void testAdmissionControlEnforcedOnNonACEnabledActions() throws ExecutionException, InterruptedException {
public void testAdmissionControlEnforcedOnNonACEnabledActions() throws Exception {
String coordinatingOnlyNode = getCoordinatingOnlyNode();
ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();

Thread.sleep(6000);
updateSettingsRequest.transientSettings(
Settings.builder()
.put(
Expand Down Expand Up @@ -248,14 +249,15 @@ public void testAdmissionControlEnforcedOnNonACEnabledActions() throws Execution
assertFalse(nodesStatsResponse.hasFailures());
}

public void testAdmissionControlRejectionOnMonitor() {
public void testAdmissionControlRejectionOnMonitor() throws Exception{
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames(INDEX_NAME);
String primaryName = primaryReplicaNodeNames.v1();
String replicaName = primaryReplicaNodeNames.v2();
String coordinatingOnlyNode = getCoordinatingOnlyNode();

AdmissionControlService admissionControlServicePrimary = internalCluster().getInstance(AdmissionControlService.class, primaryName);
AdmissionControlService admissionControlServiceReplica = internalCluster().getInstance(AdmissionControlService.class, replicaName);
Thread.sleep(6000);

ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();

Expand Down Expand Up @@ -337,14 +339,15 @@ public void testAdmissionControlRejectionOnMonitor() {
}
}

public void testAdmissionControlRejectionOnDisabled() {
public void testAdmissionControlRejectionOnDisabled() throws Exception{
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames(INDEX_NAME);
String primaryName = primaryReplicaNodeNames.v1();
String replicaName = primaryReplicaNodeNames.v2();
String coordinatingOnlyNode = getCoordinatingOnlyNode();

AdmissionControlService admissionControlServicePrimary = internalCluster().getInstance(AdmissionControlService.class, primaryName);
AdmissionControlService admissionControlServiceReplica = internalCluster().getInstance(AdmissionControlService.class, replicaName);
Thread.sleep(6000);

ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected Settings nodeSettings() {
public void testAdmissionControlRejectionEnforcedMode() throws Exception {
ensureGreen();
assertBusy(() -> assertEquals(1, getInstanceFromNode(ResourceUsageCollectorService.class).getAllNodeStatistics().size()));
Thread.sleep(6000);
client().admin().indices().prepareCreate("index").execute().actionGet();
BulkRequestBuilder bulk = client().prepareBulk();
for (int i = 0; i < 3; i++) {
Expand Down Expand Up @@ -200,6 +201,7 @@ public void testAdmissionControlRejectionEnforcedMode() throws Exception {

public void testAdmissionControlRejectionMonitorOnlyMode() throws Exception {
assertBusy(() -> assertEquals(1, getInstanceFromNode(ResourceUsageCollectorService.class).getAllNodeStatistics().size()));
Thread.sleep(6000);
// Verify that cluster state is updated
ActionFuture<ClusterStateResponse> future2 = client().admin().cluster().state(new ClusterStateRequest());
assertThat(future2.isDone(), is(true));
Expand Down Expand Up @@ -299,6 +301,7 @@ public void testAdmissionControlRejectionMonitorOnlyMode() throws Exception {

public void testAdmissionControlRejectionDisabledMode() throws Exception {
assertBusy(() -> assertEquals(1, getInstanceFromNode(ResourceUsageCollectorService.class).getAllNodeStatistics().size()));
Thread.sleep(6000);
// Verify that cluster state is updated
ActionFuture<ClusterStateResponse> future2 = client().admin().cluster().state(new ClusterStateRequest());
assertThat(future2.isDone(), is(true));
Expand Down Expand Up @@ -367,6 +370,7 @@ public void testAdmissionControlRejectionDisabledMode() throws Exception {

public void testAdmissionControlWithinLimits() throws Exception {
assertBusy(() -> assertEquals(1, getInstanceFromNode(ResourceUsageCollectorService.class).getAllNodeStatistics().size()));
Thread.sleep(6000);
// Verify that cluster state is updated
ActionFuture<ClusterStateResponse> future2 = client().admin().cluster().state(new ClusterStateRequest());
assertThat(future2.isDone(), is(true));
Expand Down

0 comments on commit 93ee481

Please sign in to comment.