[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flume-dev
Subject:    =?utf-8?q?=5BGitHub=5D_=5Bflume=5D_busbey_commented_on_a_diff_in_pull_reques?= =?utf-8?q?t_=23351=3A
From:       GitBox <git () apache ! org>
Date:       2022-10-31 16:09:20
Message-ID: PR_kwDOACGL7s4yQKSn-84b4df33-bf0c-4c56-856b-dd024f129854 () gitbox ! apache ! org
[Download RAW message or body]


busbey commented on code in PR #351:
URL: https://github.com/apache/flume/pull/351#discussion_r1009600270


##########
flume-ng-tests/src/test/java/org/apache/flume/test/util/DockerInstall.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.flume.test.util;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.io.Files;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Attempts to setup a staged install using explicitly specified tar-ball
+ * distribution or by using relative path into the flume-ng-dist module.
+ */
+public class DockerInstall extends StagedInstall {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(DockerInstall.class);
+
+  private String configFilePath;
+
+  private ProcessShutdownHook shutdownHook;
+  private ProcessInputStreamConsumer consumer;
+  private String containerId;
+
+  private static DockerInstall INSTANCE;
+  private String dockerImageId;
+
+  public static synchronized DockerInstall getInstance() throws Exception {
+    if (INSTANCE == null) {
+      INSTANCE = new DockerInstall();
+    }
+    return INSTANCE;
+  }
+
+  public synchronized boolean isRunning() {
+    return containerId != null;
+  }
+
+  public synchronized void stopAgent() throws Exception {
+    if (containerId == null) {
+      throw new Exception("Process not found");
+    }
+
+    LOGGER.info("Shutting down agent process");
+
+    ImmutableList.Builder<String> builder = new ImmutableList.Builder<>();
+    builder.add("/bin/sh");
+    builder.add("-c");
+    builder.add("'docker kill " +  containerId + "'");

Review Comment:
   all of the cases where docker is invoked here should be an environment variable or \
some such that defaults to "docker" and allows whoever is running the test to specify \
a fully qualified path to the docker executable.



-- 
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: dev-unsubscribe@flume.apache.org

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic