Repository: incubator-distributedlog Updated Branches: refs/heads/release-0.4.0-incubating c2654129f -> b35e29c47
DL-186: fix common.sh grep bug; kill MultiReader java process as expected Author: xieliang <xieliang...@gmail.com> Reviewers: Sijie Guo <si...@apache.org> Closes #114 from xieliang/DL-186-smoketest Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/b35e29c4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/b35e29c4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/b35e29c4 Branch: refs/heads/release-0.4.0-incubating Commit: b35e29c478a5174286aef588458d35d616fc0c24 Parents: c265412 Author: xieliang <xieliang...@gmail.com> Authored: Mon Jan 30 17:52:29 2017 -0800 Committer: Sijie Guo <si...@apache.org> Committed: Mon Jan 30 17:54:15 2017 -0800 ---------------------------------------------------------------------- distributedlog-benchmark/bin/common.sh | 4 +-- distributedlog-core/bin/common.sh | 4 +-- distributedlog-service/bin/common.sh | 4 +-- .../distributedlog-basic/bin/common.sh | 4 +-- .../distributedlog-messaging/bin/common.sh | 4 +-- scripts/integration/smoketest.sh | 26 +++++++++++++++++--- 6 files changed, 33 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/distributedlog-benchmark/bin/common.sh ---------------------------------------------------------------------- diff --git a/distributedlog-benchmark/bin/common.sh b/distributedlog-benchmark/bin/common.sh index 0b8278c..566563e 100755 --- a/distributedlog-benchmark/bin/common.sh +++ b/distributedlog-benchmark/bin/common.sh @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties" [ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh" # exclude tests jar -RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ $? == 0 ]; then DLOG_JAR="${RELEASE_JAR}" fi # exclude tests jar -BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then echo "\nCouldn't find dlog jar."; http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/distributedlog-core/bin/common.sh ---------------------------------------------------------------------- diff --git a/distributedlog-core/bin/common.sh b/distributedlog-core/bin/common.sh index 0b8278c..566563e 100755 --- a/distributedlog-core/bin/common.sh +++ b/distributedlog-core/bin/common.sh @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties" [ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh" # exclude tests jar -RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ $? == 0 ]; then DLOG_JAR="${RELEASE_JAR}" fi # exclude tests jar -BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then echo "\nCouldn't find dlog jar."; http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/distributedlog-service/bin/common.sh ---------------------------------------------------------------------- diff --git a/distributedlog-service/bin/common.sh b/distributedlog-service/bin/common.sh index 0b8278c..566563e 100755 --- a/distributedlog-service/bin/common.sh +++ b/distributedlog-service/bin/common.sh @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties" [ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh" # exclude tests jar -RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ $? == 0 ]; then DLOG_JAR="${RELEASE_JAR}" fi # exclude tests jar -BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then echo "\nCouldn't find dlog jar."; http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/distributedlog-tutorials/distributedlog-basic/bin/common.sh ---------------------------------------------------------------------- diff --git a/distributedlog-tutorials/distributedlog-basic/bin/common.sh b/distributedlog-tutorials/distributedlog-basic/bin/common.sh index 0b8278c..566563e 100755 --- a/distributedlog-tutorials/distributedlog-basic/bin/common.sh +++ b/distributedlog-tutorials/distributedlog-basic/bin/common.sh @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties" [ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh" # exclude tests jar -RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ $? == 0 ]; then DLOG_JAR="${RELEASE_JAR}" fi # exclude tests jar -BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then echo "\nCouldn't find dlog jar."; http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/distributedlog-tutorials/distributedlog-messaging/bin/common.sh ---------------------------------------------------------------------- diff --git a/distributedlog-tutorials/distributedlog-messaging/bin/common.sh b/distributedlog-tutorials/distributedlog-messaging/bin/common.sh index 0b8278c..566563e 100755 --- a/distributedlog-tutorials/distributedlog-messaging/bin/common.sh +++ b/distributedlog-tutorials/distributedlog-messaging/bin/common.sh @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties" [ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh" # exclude tests jar -RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ $? == 0 ]; then DLOG_JAR="${RELEASE_JAR}" fi # exclude tests jar -BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1) +BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1) if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then echo "\nCouldn't find dlog jar."; http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/b35e29c4/scripts/integration/smoketest.sh ---------------------------------------------------------------------- diff --git a/scripts/integration/smoketest.sh b/scripts/integration/smoketest.sh index 0de830d..fdb10c6 100755 --- a/scripts/integration/smoketest.sh +++ b/scripts/integration/smoketest.sh @@ -42,10 +42,17 @@ export WP_NAMESPACE="distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE SMOKESTREAM_PREFIX="smoketest-stream-" # start the sandbox +echo "start sandbox" nohup ${DLOG_ROOT}/distributedlog-service/bin/dlog local ${ZK_PORT} > ${LOG_DIR}/sandbox.out 2>&1& + +if [ $? -ne 0 ]; then + echo "Failed to start sandbox" + exit 1 +fi echo $! > ${LOG_DIR}/sandbox.pid # create namespace +echo "create namespace" ${DLOG_ROOT}/distributedlog-core/bin/dlog admin bind -l /ledgers -s 127.0.0.1:${ZK_PORT} -c distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} if [ $? -ne 0 ]; then @@ -54,6 +61,7 @@ if [ $? -ne 0 ]; then fi # create streams +echo "create streams" ${DLOG_ROOT}/distributedlog-service/bin/dlog tool create -u distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} -r ${SMOKESTREAM_PREFIX} -e 1-5 -f if [ $? -ne 0 ]; then @@ -62,6 +70,7 @@ if [ $? -ne 0 ]; then fi # list streams +echo "list streams" STREAM_OUTPUT=$(${DLOG_ROOT}/distributedlog-service/bin/dlog tool list -u distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} | grep "${SMOKESTREAM_PREFIX}") echo "Create streams : ${STREAM_OUTPUT}." @@ -74,34 +83,43 @@ for i in {1..5}; do done # start a write proxy +echo "start a write proxy" ${DLOG_ROOT}/distributedlog-service/bin/dlog-daemon.sh start writeproxy -# tail the the streams +# tail the streams +echo "tail the streams" nohup ${DLOG_ROOT}/distributedlog-tutorials/distributedlog-basic/bin/runner run org.apache.distributedlog.basic.MultiReader distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} ${SMOKESTREAM_PREFIX}1,${SMOKESTREAM_PREFIX}2,${SMOKESTREAM_PREFIX}3,${SMOKESTREAM_PREFIX}4,${SMOKESTREAM_PREFIX}5 > ${LOG_DIR}/reader.out 2>&1& echo $! > ${LOG_DIR}/reader.pid # generate the records +echo "generate the records" nohup ${DLOG_ROOT}/distributedlog-tutorials/distributedlog-basic/bin/runner run org.apache.distributedlog.basic.RecordGenerator "inet!127.0.0.1:${WP_SERVICE_PORT}" ${SMOKESTREAM_PREFIX}1 1 > ${LOG_DIR}/writer.out 2>&1& echo $! > ${LOG_DIR}/writer.pid # wait for 20 seconds +echo "sleep 20" sleep 20 # kill the writer +echo "kill the writer" if [ -f ${LOG_DIR}/writer.pid ]; then writerpid=$(cat ${LOG_DIR}/writer.pid) if kill -0 $writerpid > /dev/null 2>&1; then + echo "kill $writerpid" kill $writerpid fi fi -# stop the reader +# kill the reader +echo "kill the reader" if [ -f ${LOG_DIR}/reader.pid ]; then readerpid=$(cat ${LOG_DIR}/reader.pid) if kill -0 $readerpid > /dev/null 2>&1; then + echo "kill $readerpid" kill $readerpid fi fi +ps ax | grep MultiReader | grep java | grep -v grep | awk '{print $1}' | xargs kill -9 # check the number of records received NUM_RECORDS=`cat ${LOG_DIR}/reader.out | grep "record-" | wc -l` @@ -114,10 +132,12 @@ if [ $NUM_RECORDS -lt 18 ]; then exit 1 fi -# stop a write proxy +# stop the write proxy +echo "stop the write proxy" ${DLOG_ROOT}/distributedlog-service/bin/dlog-daemon.sh stop writeproxy # stop the sandbox +echo "stop the sandbox" kill `cat ${LOG_DIR}/sandbox.pid` exit 0