lzshlzsh commented on code in PR #22612: URL: https://github.com/apache/flink/pull/22612#discussion_r1202716866
########## flink-connectors/flink-connector-hbase-base/src/test/java/org/apache/flink/connector/hbase/util/HBaseTimestampGeneratorTest.java: ########## @@ -0,0 +1,43 @@ +/* + * 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.flink.connector.hbase.util; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** Tests for {@link HBaseTimestampGenerator}. */ +public class HBaseTimestampGeneratorTest { + @Test + public void testStronglyIncreasingTimestampGenerator() { + HBaseTimestampGenerator timestampGenerator = HBaseTimestampGenerator.stronglyIncreasing(); + long lastTimestamp = 0; + for (int i = 0; i < 100_000_000; i++) { Review Comment: > Please have a look at https://flink.apache.org/how-to-contribute/code-style-and-quality-common/#7-testing - Having a test run 100 million times isn't an effective test Thank you for your review and valuable feedback. I think I may need to use Junit5 to write test cases, and change 100 million times tests to one times。Can you give more suggestions on how to write this test? Actually, I have another question. How to write test cases for the probability of errors occurring in this data loss situation, as we cannot assert a definite state ? -- 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]
