This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 504434e  AMBARI-23371. Update Log Search integration test framework to 
work with Solr7 API. (#793)
504434e is described below

commit 504434e672f803e4fdeb9548abbac221ab6bde5f
Author: Olivér Szabó <oleew...@gmail.com>
AuthorDate: Tue Mar 27 04:02:21 2018 -0700

    AMBARI-23371. Update Log Search integration test framework to work with 
Solr7 API. (#793)
    
    * AMBARI-23371. Update Log Search integration test framework to work with 
Solr7 API.
    
    * AMBARI-23371. X11 additions.
    
    * AMBARI-23371. Fix display.
---
 ambari-logsearch/README.md                                 |  2 +-
 .../apache/ambari/logsearch/domain/StoryDataRegistry.java  |  9 +++++++++
 .../ambari/logsearch/steps/AbstractLogSearchSteps.java     | 13 ++++++++-----
 .../ambari/logsearch/steps/LogSearchDockerSteps.java       |  2 +-
 ambari-logsearch/docker/all.yml                            |  2 +-
 ambari-logsearch/docker/logsearch-docker.sh                | 14 +++++++++++---
 6 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/ambari-logsearch/README.md b/ambari-logsearch/README.md
index 2a124d1..fb3b56b 100644
--- a/ambari-logsearch/README.md
+++ b/ambari-logsearch/README.md
@@ -59,7 +59,7 @@ By default integration tests are not a part of the build 
process, you need to se
 # from ambari-logsearch folder
 mvn clean integration-test -Dbackend-tests failsafe:verify
 # or run selenium tests with docker for mac, but before that you nedd to start 
xquartz
-xquartz
+open -a XQuartz
 # then in an another window you can start ui tests
 mvn clean integration-test -Dselenium-tests failsafe:verify
 # you can specify story file folde location with -Dbackend.stories.location 
and -Dui.stories.location (absolute file path) in the commands
diff --git 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
index 41d6391..5839881 100644
--- 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
+++ 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
@@ -29,6 +29,7 @@ public class StoryDataRegistry {
   private String dockerHost;
   private String ambariFolder;
   private String shellScriptLocation;
+  private String shellScriptFolder;
   private final int solrPort = 8886;
   private final int logsearchPort = 61888;
   private final int zookeeperPort = 9983;
@@ -106,4 +107,12 @@ public class StoryDataRegistry {
   public void setWebDriverProvider(WebDriverProvider webDriverProvider) {
     this.webDriverProvider = webDriverProvider;
   }
+
+  public String getShellScriptFolder() {
+    return shellScriptFolder;
+  }
+
+  public void setShellScriptFolder(String shellScriptFolder) {
+    this.shellScriptFolder = shellScriptFolder;
+  }
 }
diff --git 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/AbstractLogSearchSteps.java
 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/AbstractLogSearchSteps.java
index a778284..f92516f 100644
--- 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/AbstractLogSearchSteps.java
+++ 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/AbstractLogSearchSteps.java
@@ -49,9 +49,11 @@ public class AbstractLogSearchSteps {
       URL location = 
LogSearchDockerSteps.class.getProtectionDomain().getCodeSource().getLocation();
       String ambariFolder = new 
File(location.toURI()).getParentFile().getParentFile().getParentFile().getParent();
       StoryDataRegistry.INSTANCE.setAmbariFolder(ambariFolder);
-      String shellScriptLocation = ambariFolder + 
"/ambari-logsearch/docker/logsearch-docker.sh";
+      String scriptFolder = ambariFolder + "/ambari-logsearch/docker/";
+      StoryDataRegistry.INSTANCE.setShellScriptFolder(scriptFolder);
+      String shellScriptLocation = scriptFolder + "logsearch-docker.sh";
       StoryDataRegistry.INSTANCE.setShellScriptLocation(shellScriptLocation);
-      String output = runCommand(new 
String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(), "start"});
+      String output = runCommand(scriptFolder, new 
String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(), "start"});
       LOG.info("Command output: {}", output);
       StoryDataRegistry.INSTANCE.setLogsearchContainerStarted(true);
 
@@ -74,7 +76,7 @@ public class AbstractLogSearchSteps {
     for (int tries = 1; tries < maxTries; tries++) {
       try {
         SolrClient solrClient = new LBHttpSolrClient.Builder()
-          
.withBaseSolrUrl(String.format("http://%s:%d/solr/%s_shard0_replica1";,
+          
.withBaseSolrUrl(String.format("http://%s:%d/solr/%s_shard0_replica_n1";,
             StoryDataRegistry.INSTANCE.getDockerHost(),
             StoryDataRegistry.INSTANCE.getSolrPort(),
             StoryDataRegistry.INSTANCE.getServiceLogsCollection()))
@@ -105,6 +107,7 @@ public class AbstractLogSearchSteps {
     boolean solrHasData = false;
     int maxTries = 60;
     String lastExceptionMessage = null;
+
     for (int tries = 1; tries < maxTries; tries++) {
       try {
         SolrClient solrClient = StoryDataRegistry.INSTANCE.getSolrClient();
@@ -150,10 +153,10 @@ public class AbstractLogSearchSteps {
   }
 
 
-  protected String runCommand(String[] command) {
+  protected String runCommand(String location, String[] command) {
     try {
       LOG.info("Exec command: {}", StringUtils.join(command, " "));
-      Process process = Runtime.getRuntime().exec(command);
+      Process process = Runtime.getRuntime().exec(command, null, new 
File(location));
       BufferedReader reader = new BufferedReader(new 
InputStreamReader(process.getInputStream()));
       return reader.readLine();
     } catch (Exception e) {
diff --git 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
index cb67fcc..cbbeb2d 100644
--- 
a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
+++ 
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
@@ -62,6 +62,6 @@ public class LogSearchDockerSteps extends 
AbstractLogSearchSteps {
 
   @AfterStories
   public void removeLogSearchContainer() {
-    runCommand(new 
String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(), "stop"});
+    runCommand(StoryDataRegistry.INSTANCE.getShellScriptFolder(), new 
String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(), "stop"});
   }
 }
diff --git a/ambari-logsearch/docker/all.yml b/ambari-logsearch/docker/all.yml
index a5afb9a..cd00853 100644
--- a/ambari-logsearch/docker/all.yml
+++ b/ambari-logsearch/docker/all.yml
@@ -30,7 +30,7 @@ services:
           - 4444:4444
           - 9983:9983
         environment:
-          DISPLAY: $DOCKERIP:0
+          DISPLAY: $DISPLAY_MAC
         volumes:
           - $MAVEN_REPOSITORY_LOCATION:/root/.m2
           - $AMBARI_LOCATION:/root/ambari
diff --git a/ambari-logsearch/docker/logsearch-docker.sh 
b/ambari-logsearch/docker/logsearch-docker.sh
index 4657a2d..9b075cb 100755
--- a/ambari-logsearch/docker/logsearch-docker.sh
+++ b/ambari-logsearch/docker/logsearch-docker.sh
@@ -100,9 +100,9 @@ function setup_env() {
     pushd $sdir/../../
     local AMBARI_LOCATION=$(pwd)
     popd
-    local docker_ip=$(get_docker_ip)
+    local display_ip=$(get_docker_ip)
     cat << EOF > $sdir/.env
-DOCKERIP=$docker_ip
+DISPLAY_MAC=$display_ip:0
 MAVEN_REPOSITORY_LOCATION=$HOME/.m2
 AMBARI_LOCATION=$AMBARI_LOCATION
 
@@ -121,6 +121,11 @@ function kill_logsearch_container() {
   docker rm -f logsearch
 }
 
+function setup_x11() {
+  local display_ip=$(get_docker_ip)
+  xhost + $display_ip
+}
+
 case $command in
   "build-and-run")
      build_logsearch_project
@@ -151,7 +156,10 @@ case $command in
   "stop")
      kill_logsearch_container
      ;;
+  "setup-x11")
+     setup_x11
+     ;;
    *)
-   echo "Available commands: 
(start|stop|build-and-run|build|build-docker-and-run|build-mvn-and-run|build-docker-only|build-mvn-only)"
+   echo "Available commands: 
(start|stop|build-and-run|build|build-docker-and-run|build-mvn-and-run|build-docker-only|build-mvn-only|setup-x11)"
    ;;
 esac

-- 
To stop receiving notification emails like this one, please contact
oleew...@apache.org.

Reply via email to