Skip to content

Commit

Permalink
Add $PULSAR_TEST_DEBUG (set true to use) and --debug flag to
Browse files Browse the repository at this point in the history
pulsar-check to aid in debugging test problems. Setting the env var also
disables cleanup (which now also prevents cleanup of the test client
directory as well as the server directory). Also, givee the client and
server tempdirs meaningful names so that it's more obvious what you're
looking at.
  • Loading branch information
natefoo committed Sep 15, 2020
1 parent 86c8aa1 commit 54b89fb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
23 changes: 17 additions & 6 deletions install_test/common_functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ set -e

shopt -s nullglob

PULSAR_TARGET_PORT="${PULSAR_TARGET_PORT:-8913}"
PULSAR_INSTALL_TARGET="${PULSAR_INSTALL_TARGET:-pulsar-app}"
PLANEMO_INSTALL_TARGET="${PLANEMO_INSTALL_TARGET:-planemo==0.36.1}"
: ${PULSAR_TARGET_PORT:=8913}
: ${PULSAR_INSTALL_TARGET:=pulsar-app}
: ${PULSAR_TEST_DEBUG:=false}
: ${PLANEMO_INSTALL_TARGET:=planemo==0.36.1}

init_temp_dir() {
TEMP_DIR=`mktemp -d`
case $(uname -s) in
Darwin)
TEMP_DIR=`mktemp -d -t pulsar-check-server`
;;
*)
TEMP_DIR=`mktemp -d -t pulsar-check-server.XXXXXXXX`
;;
esac
echo "Setting up test directory $TEMP_DIR"
cd "$TEMP_DIR"
}

init_pulsar() {
PULSAR_INSTALL_TARGET="${PULSAR_INSTALL_TARGET:-pulsar-app}"
PROJECT_DIR="$SCRIPT_DIR/.."

mkdir pulsar
Expand Down Expand Up @@ -55,7 +62,11 @@ check_pulsar() {
done
sleep 2
echo "Running a standalone Pulsar job."
pulsar-check # runs a test job
if ! $PULSAR_TEST_DEBUG; then
pulsar-check # runs a test job
else
pulsar-check --debug --disable_cleanup
fi
echo "Stopping Pulsar daemon."
pulsar --stop-daemon
echo "End Pulsar Checks"
Expand Down
9 changes: 7 additions & 2 deletions pulsar/client/test/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Exercises various features both the Pulsar client and server.
"""

import logging
import optparse
import os
import re
Expand Down Expand Up @@ -118,6 +119,7 @@ def assert_path_contents(path, expected_contents):
"is useful to checking the files generated during "
"the job and stored on the Pulsar server.")
HELP_JOB_ID = "Submit the Pulsar job with this 'external' id."
HELP_DEBUG = "Enable debug log output from Pulsar client"

EXPECTED_OUTPUT = b"hello world output"
EXAMPLE_UNICODE_TEXT = u'єχαмρℓє συтρυт'
Expand All @@ -136,9 +138,10 @@ def __init__(self, tool_dir):


def run(options):
logging.basicConfig(level=logging.DEBUG)
waiter = None
try:
temp_directory = tempfile.mkdtemp()
temp_directory = tempfile.mkdtemp(prefix='pulsar-check-client.')
temp_index_dir = os.path.join(temp_directory, "idx", "bwa")
temp_index_dir_sibbling = os.path.join(temp_directory, "idx", "seq")
temp_shared_dir = os.path.join(temp_directory, "shared", "test1")
Expand Down Expand Up @@ -284,7 +287,8 @@ def run(options):
finally:
if waiter is not None:
waiter.shutdown()
shutil.rmtree(temp_directory)
if getattr(options, 'cleanup', True):
shutil.rmtree(temp_directory)


class Waiter(object):
Expand Down Expand Up @@ -513,6 +517,7 @@ def main(argv=None):
parser.add_option('--suppress_output', default=False, action="store_true", help=HELP_SUPPRESS_OUTPUT)
parser.add_option('--disable_cleanup', dest="cleanup", default=True, action="store_false", help=HELP_DISABLE_CLEANUP)
parser.add_option('--job_id', default="123456", help=HELP_JOB_ID)
parser.add_option('--debug', default=False, action="store_true", help=HELP_DEBUG)
(options, args) = parser.parse_args(argv)
run(options)

Expand Down

0 comments on commit 54b89fb

Please sign in to comment.