From 0f8ec795647b3bb775d5c261a01bc6b308ec0519 Mon Sep 17 00:00:00 2001 From: Raghav Kumar Gautam Date: Mon, 9 Jan 2017 17:06:22 -0800 Subject: [PATCH] STORM-2268: Fix integration test for Travis CI build --- integration-test/config/Vagrantfile | 9 +++---- integration-test/config/install-storm.sh | 7 ++--- integration-test/pom.xml | 2 +- integration-test/run-it.sh | 26 +++++++++++-------- .../org/apache/storm/st/wrapper/TopoWrap.java | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/integration-test/config/Vagrantfile b/integration-test/config/Vagrantfile index 7898d9b065f..740d0b02cc4 100644 --- a/integration-test/config/Vagrantfile +++ b/integration-test/config/Vagrantfile @@ -20,11 +20,12 @@ require 'uri' # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" STORM_BOX_TYPE = "hashicorp/precise64" -STORM_ZIP = Dir.glob("../../storm-dist/binary/target/**/*.zip") +STORM_ZIP = Dir.glob("../../storm-dist/binary/**/*.zip") if(STORM_ZIP.length != 1) - raise "expected one storm-binary found: " + STORM_ZIP.join(",") + raise "Expected one storm-binary found: " + STORM_ZIP.join(",") + ". Did you run : cd ${STORM_SRC_DIR}/storm-dist/binary && mvn clean package -Dgpg.skip=true" end STORM_ARCHIVE = STORM_ZIP[0] +puts "Using storm archive: " + STORM_ARCHIVE STORM_VERSION = File.basename(STORM_ARCHIVE, '.*') STORM_SUPERVISOR_COUNT = 2 @@ -52,10 +53,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| } end - if(!File.exist?(STORM_ARCHIVE)) - `wget -N #{STORM_DIST_URL}` - end - config.vm.synced_folder "../../", "/home/vagrant/build/vagrant/storm" config.vm.synced_folder "~/.m2", "/home/vagrant/.m2" diff --git a/integration-test/config/install-storm.sh b/integration-test/config/install-storm.sh index 2731abe5ea9..b08e2bc3cab 100644 --- a/integration-test/config/install-storm.sh +++ b/integration-test/config/install-storm.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -25,13 +26,13 @@ chown -R storm:storm /usr/share/apache-storm* ln -s /usr/share/apache-storm* /usr/share/storm ln -s /usr/share/storm/bin/storm /usr/bin/storm -mkdir /etc/storm -chown storm:storm /etc/storm +mkdir -p /etc/storm/conf +chown -R storm:storm /etc/storm rm /usr/share/storm/conf/storm.yaml cp "${SCRIPT_DIR}/storm.yaml" /usr/share/storm/conf/ cp "${SCRIPT_DIR}/cluster.xml" /usr/share/storm/logback/ -ln -s /usr/share/storm/conf/storm.yaml /etc/storm/storm.yaml +ln -s /usr/share/storm/conf/storm.yaml /etc/storm/conf/storm.yaml mkdir /var/log/storm chown storm:storm /var/log/storm diff --git a/integration-test/pom.xml b/integration-test/pom.xml index 5d37458d259..a1081ac1043 100755 --- a/integration-test/pom.xml +++ b/integration-test/pom.xml @@ -26,7 +26,7 @@ .. - storm-integration-test + Storm Integration Test org.apache.storm storm-integration-test jar diff --git a/integration-test/run-it.sh b/integration-test/run-it.sh index 3b4a86167e9..3194a926e00 100755 --- a/integration-test/run-it.sh +++ b/integration-test/run-it.sh @@ -20,7 +20,7 @@ set -x set -e SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo SCRIPT_DIR="${SCRIPT_DIR}" -STORM_SRC_DIR=$(dirname ${SCRIPT_DIR}) +STORM_SRC_DIR=$(dirname "${SCRIPT_DIR}") echo SCRIPT_SRC_DIR="${SCRIPT_SRC_DIR}" function die() { echo $* @@ -49,24 +49,28 @@ if [[ "${USER}" == "vagrant" ]]; then # install oracle jdk8 export MAVEN_OPTS="-Xmx3000m" else ( while true; do echo "heartbeat"; sleep 300; done ) & #heartbeat needed by travis ci - (cd ${STORM_SRC_DIR} && mvn clean install -DskipTests=true) || die "maven install command failed" - (cd ${STORM_SRC_DIR}/storm-dist/binary && mvn package -Dgpg.skip=true) || die "maven package command failed" + (cd "${STORM_SRC_DIR}" && mvn clean install -DskipTests=true) || die "maven install command failed" + if [[ "${USER}" == "travis" ]]; then + ( cd "${STORM_SRC_DIR}/storm-dist/binary" && mvn clean package -Dgpg.skip=true ) + fi + (( $(find "${STORM_SRC_DIR}/storm-dist/binary" -iname 'apache-storm*.zip' | wc -l) == 1 )) || die "expected exactly one zip file, did you run: cd ${STORM_SRC_DIR}/storm-dist/binary && mvn clean package -Dgpg.skip=true" fi -storm_binary_zip=$(find ${STORM_SRC_DIR}/storm-dist -iname '*.zip') -storm_binary_name=$(basename ${storm_binary_zip}) -export STORM_VERSION=$(grep -oPe '\d.*(?=.zip)' <<<${storm_binary_name}) + +storm_binary_zip=$(find "${STORM_SRC_DIR}/storm-dist" -iname '*.zip') +storm_binary_name=$(basename "${storm_binary_zip}") +export STORM_VERSION=$(grep -oPe '\d.*(?=.zip)' <<<"${storm_binary_name}") echo "Using storm version:" ${STORM_VERSION} # setup storm cluster list_storm_processes || true -sudo bash ${SCRIPT_DIR}/config/common.sh -sudo bash ${SCRIPT_DIR}/config/install-zookeeper.sh -sudo bash ${SCRIPT_DIR}/config/install-storm.sh $storm_binary_zip -export JAVA_HOME +sudo bash "${SCRIPT_DIR}/config/common.sh" +sudo bash "${SCRIPT_DIR}/config/install-zookeeper.sh" +sudo bash "${SCRIPT_DIR}/config/install-storm.sh" "$storm_binary_zip" +export JAVA_HOME="${JAVA_HOME}" env function start_storm_process() { echo starting: storm $1 - sudo su storm -c "export JAVA_HOME=${JAVA_HOME} && cd /home/storm && storm $1" & + sudo su storm -c "export JAVA_HOME=\"${JAVA_HOME}\" && cd /usr/share/storm && storm $1" & } start_storm_process nimbus start_storm_process ui diff --git a/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java b/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java index be1db6b84cf..2be040220cf 100644 --- a/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java +++ b/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java @@ -256,7 +256,7 @@ public int hashCode() { public ExecutorURL(String componentId, String host, int logViewerPort, int executorPort, String topoId) throws MalformedURLException { String sep = "%2F"; //hex of "/" String viewUrlStr = String.format("http://%s:%s/log?file=", host, logViewerPort); - String downloadUrlStr = String.format("http://%s:%s/download", host, logViewerPort); + String downloadUrlStr = String.format("http://%s:%s/download?file=%%2F", host, logViewerPort); viewUrl = new URL(String.format("%s/%s%s%d%sworker.log", viewUrlStr, topoId, sep, executorPort, sep)); downloadUrl = new URL(String.format("%s/%s%s%d%sworker.log", downloadUrlStr, topoId, sep, executorPort, sep)); this.componentId = componentId;