timothy-e commented on code in PR #18287:
URL: https://github.com/apache/pinot/pull/18287#discussion_r3131449749


##########
pinot-core/src/test/java/org/apache/pinot/core/transport/grpc/GrpcQueryServerTest.java:
##########
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.transport.grpc;
+
+import io.grpc.stub.StreamObserver;
+import org.apache.pinot.common.config.GrpcConfig;
+import org.apache.pinot.common.metrics.ServerMeter;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.proto.Server.ServerRequest;
+import org.apache.pinot.common.proto.Server.ServerResponse;
+import org.apache.pinot.core.query.executor.QueryExecutor;
+import org.apache.pinot.server.access.AccessControl;
+import org.apache.pinot.spi.accounting.ThreadAccountantUtils;
+import org.apache.pinot.spi.metrics.PinotMetricUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.testng.Assert.assertEquals;
+
+
+/// Tests that {@link GrpcQueryServer} (SSE path) does not touch MSE-specific 
metrics.
+public class GrpcQueryServerTest {
+
+  private GrpcQueryServer _grpcQueryServer;
+
+  @BeforeClass
+  public void setUp()
+      throws Exception {
+    ServerMetrics.deregister();
+    ServerMetrics.register(new 
ServerMetrics(PinotMetricUtils.getPinotMetricsRegistry()));
+
+    GrpcConfig grpcConfig = new 
GrpcConfig(GrpcConfig.DEFAULT_MAX_INBOUND_MESSAGE_BYTES_SIZE, true);
+    // Use port 0 so the OS picks a free port; we don't actually need the 
network for this test.
+    _grpcQueryServer = new GrpcQueryServer("testServer", 0, grpcConfig, null,
+        mock(QueryExecutor.class), mock(AccessControl.class), 
ThreadAccountantUtils.getNoOpAccountant());
+    _grpcQueryServer.start();
+  }
+
+  @AfterClass
+  public void tearDown() {
+    if (_grpcQueryServer != null) {
+      _grpcQueryServer.shutdown();
+    }
+    ServerMetrics.deregister();
+  }
+
+  /// Calls {@link GrpcQueryServer#submit} directly (bypassing gRPC transport) 
and verifies that
+  /// {@link ServerMeter#MSE_QUERIES} is never touched by the SSE path.
+  @Test
+  public void testMseQueriesNotIncrementedBySsePath() {

Review Comment:
   It wasn't super obvious to me that the code path 
`pinot-query-runtime/src/main/java/org/apache/pinot/query/service/server/QueryServer.java`
 is strictly MSE only. I knew MSE used GRPC, and I wanted to make sure that my 
change didn't erroneously affect other GRPC paths. I could do that with a 
manual test, but a unit test helps guarantee that if we ever refactor GRPC code 
to share more code, we won't start counting them as MSE requests. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to