88
99package org .opensearch .transport .grpc ;
1010
11- import org .apache .logging .log4j .LogManager ;
12- import org .apache .logging .log4j .Logger ;
1311import org .opensearch .protobufs .Aggregate ;
1412import org .opensearch .protobufs .AggregationContainer ;
1513import org .opensearch .protobufs .CreatePITResponse ;
3331 * Integration tests for the SearchService gRPC service.
3432 */
3533public class SearchServiceIT extends GrpcTransportBaseIT {
36- private static final Logger logger = LogManager .getLogger (SearchServiceIT .class );
3734
3835 /**
3936 * Tests PIT creation via gRPC.
@@ -48,7 +45,6 @@ public void testCreatePit() throws Exception {
4845 SearchServiceGrpc .SearchServiceBlockingStub searchStub = SearchServiceGrpc .newBlockingStub (channel );
4946
5047 CreatePitRequest request = CreatePitRequest .newBuilder ().addIndex (indexName ).setKeepAlive ("1m" ).build ();
51- logRequest ("CreatePit" , request );
5248 CreatePITResponse response = searchStub .createPit (request );
5349
5450 assertNotNull ("Create PIT response should not be null" , response );
@@ -59,9 +55,7 @@ public void testCreatePit() throws Exception {
5955 assertTrue ("Successful shards should be positive" , response .getXShards ().getSuccessful () > 0 );
6056 assertEquals ("Failed shards should be zero" , 0 , response .getXShards ().getFailed ());
6157
62- DeletePitRequest deleteRequest = DeletePitRequest .newBuilder ().addPitId (response .getPitId ()).build ();
63- logRequest ("DeletePit" , deleteRequest );
64- DeletePITResponse deleteResponse = searchStub .deletePit (deleteRequest );
58+ DeletePITResponse deleteResponse = searchStub .deletePit (DeletePitRequest .newBuilder ().addPitId (response .getPitId ()).build ());
6559 assertEquals ("Should have one delete result" , 1 , deleteResponse .getPitsCount ());
6660 assertEquals ("Deleted PIT id should match" , response .getPitId (), deleteResponse .getPits (0 ).getPitId ());
6761 assertTrue ("Delete PIT should be successful" , deleteResponse .getPits (0 ).getSuccessful ());
@@ -80,13 +74,12 @@ public void testDeletePit() throws Exception {
8074 ManagedChannel channel = client .getChannel ();
8175 SearchServiceGrpc .SearchServiceBlockingStub searchStub = SearchServiceGrpc .newBlockingStub (channel );
8276
83- CreatePitRequest createRequest = CreatePitRequest . newBuilder (). addIndex ( indexName ). setKeepAlive ( "1m" ). build ();
84- logRequest ( "CreatePit" , createRequest );
85- CreatePITResponse createResponse = searchStub . createPit ( createRequest );
77+ CreatePITResponse createResponse = searchStub . createPit (
78+ CreatePitRequest . newBuilder (). addIndex ( indexName ). setKeepAlive ( "1m" ). build ()
79+ );
8680 assertFalse ("PIT id should not be empty" , createResponse .getPitId ().isEmpty ());
8781
8882 DeletePitRequest deleteRequest = DeletePitRequest .newBuilder ().addPitId (createResponse .getPitId ()).build ();
89- logRequest ("DeletePit" , deleteRequest );
9083 DeletePITResponse deleteResponse = searchStub .deletePit (deleteRequest );
9184
9285 assertNotNull ("Delete PIT response should not be null" , deleteResponse );
@@ -267,8 +260,4 @@ public void testTermsAggregation() throws Exception {
267260 assertEquals ("Second bucket doc count should be 1" , 1 , sterms .getBuckets (1 ).getDocCount ());
268261 }
269262 }
270-
271- private static void logRequest (String requestType , Object request ) {
272- logger .info ("{} request proto:\n {}" , requestType , request );
273- }
274263}
0 commit comments