fapaul commented on a change in pull request #17271:
URL: https://github.com/apache/flink/pull/17271#discussion_r708352870



##########
File path: 
flink-end-to-end-tests/flink-end-to-end-tests-pulsar/src/test/java/org/apache/flink/tests/util/pulsar/FlinkContainerWithPulsarEnvironment.java
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.tests.util.pulsar;
+
+import org.apache.flink.tests.util.TestUtils;
+import org.apache.flink.tests.util.flink.FlinkContainerTestEnvironment;
+
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/** A Flink Container which would bundles pulsar connector in its classpath. */
+public class FlinkContainerWithPulsarEnvironment extends 
FlinkContainerTestEnvironment
+        implements BeforeAllCallback, AfterAllCallback {

Review comment:
       One thing you could is the following for both test classes 
`PulsarSourceKeySharedE2ECase` `PulsarSourceSharedE2ECase` 
   
   ```java
   @ExtendWith({
           ConnectorTestingExtension.class,
           TestLoggerExtension.class,
           TestCaseInvocationContextProvider.class
   })
   @TestInstance(TestInstance.Lifecycle.PER_CLASS)
   @SuppressWarnings("java:S3577")
   class PulsarSourceKeySharedE2ECase {
   
       /** Flink runtime. */
       @TestEnv
       final FlinkContainerWithPulsarEnvironment flink = new 
FlinkContainerWithPulsarEnvironment(1, 6);
   
       /** Pulsar runtime. */
       @ExternalSystem
       final PulsarTestEnvironment pulsar =
               new PulsarTestEnvironment(container(flink.getFlinkContainer()));
   
       @TestTemplate
       @DisplayName(....)
       void testConsumingMessageFromTheSpecifiedHashRange(TestEnvironment 
testEnv, ExternalContext<T> externalContext) throws Exception {
   ....
       }
   }
   ```
    
   I think it makes sense to reuse the existing annotations here and you can 
get rid of the additional `BeforeAllCallback` and `AfterAllCallback`.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to