wombatu-kun commented on code in PR #19204:
URL: https://github.com/apache/hudi/pull/19204#discussion_r3555969642


##########
hudi-common/src/test/java/org/apache/hudi/core/index/secondary/TestSecondaryIndexManagerSingleton.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.hudi.core.index.secondary;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Tests {@link SecondaryIndexManager#getInstance()} in isolation from
+ * {@link TestSecondaryIndexManager}'s mocked-metaClient fixture, which this 
test doesn't need.
+ */
+public class TestSecondaryIndexManagerSingleton {
+
+  @Test
+  public void testGetInstanceReturnsSingleton() {

Review Comment:
   Inlining is right. One nuance: the check is not strictly unfalsifiable, 
since `getInstance` is double-checked locking over a `volatile` field and a 
regression that returned a fresh instance per call would fail it. What makes it 
weak is `assertEquals` on a class with no `equals` override, which reads as 
value equality but silently degrades to reference equality. Inlining it into 
`TestSecondaryIndexManager` as `assertSame(SecondaryIndexManager.getInstance(), 
SecondaryIndexManager.getInstance())` keeps the guard and makes the intent 
explicit.



-- 
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]

Reply via email to