ferenc-csaky commented on code in PR #12:
URL: 
https://github.com/apache/flink-connector-hbase/pull/12#discussion_r1258130085


##########
flink-connector-hbase-e2e-tests/src/main/java/org/apache/flink/streaming/tests/HBaseContainer.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.streaming.tests;
+
+import com.github.dockerjava.api.command.InspectContainerResponse;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.ImageFromDockerfile;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+/** Standalone containerized HBase instance that builds the image on the fly. 
*/
+public class HBaseContainer extends GenericContainer<HBaseContainer> {
+
+    private static final String HBASE_BIN = "/opt/hbase/bin";
+    private static final int MAX_RETRIES = 3;
+
+    public HBaseContainer(String hbaseVersion) {
+        super(getImageFromDockerfile(hbaseVersion));
+    }
+
+    private static ImageFromDockerfile getImageFromDockerfile(String 
hbaseVersion) {
+        return new ImageFromDockerfile()
+                .withDockerfileFromBuilder(
+                        builder ->
+                                builder.from("adoptopenjdk/openjdk8")
+                                        .env("HBASE_VERSION", hbaseVersion)
+                                        .run(
+                                                "export INITRD=no"
+                                                        + " && export 
HBASE_DIST=\"http://archive.apache.org/dist/hbase\"";
+                                                        + " && apt-get update 
-y"
+                                                        + " && apt-get install 
-y --no-install-recommends curl"
+                                                        + " && cd /opt"
+                                                        + " && curl -SL 
$HBASE_DIST/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz"
+                                                        + " | tar -x -z && mv 
hbase-${HBASE_VERSION} hbase")

Review Comment:
   So it would not would be required to build this on the fly for every 
execution?



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