kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [1/3] incubator-kudu git commit: KUDU-1313. Fix client_samples-test to allow parallel runs on the same machine
Date Wed, 27 Jan 2016 23:08:44 GMT
Repository: incubator-kudu
Updated Branches:
  refs/heads/master a12d87e49 -> 1aeb75bbe


KUDU-1313. Fix client_samples-test to allow parallel runs on the same machine

This switches the shell script to use the same pid-based trickery to
generate a unique localhost IP address that the other tests use.

Tested manually by running 'ctest -R samples &' four times in quick
succession. Without the patch, 3/4 of the runs failed. With the patch,
they all succeeded.

Change-Id: Iae90683a1c2264501a5740848b524841500e261e
Reviewed-on: http://gerrit.cloudera.org:8080/1919
Reviewed-by: Jean-Daniel Cryans
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/de6df2e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/de6df2e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/de6df2e9

Branch: refs/heads/master
Commit: de6df2e9cf17a88829afbfc52018f3271c874aa4
Parents: a12d87e
Author: Todd Lipcon <todd@apache.org>
Authored: Wed Jan 27 09:59:30 2016 -0800
Committer: Todd Lipcon <todd@apache.org>
Committed: Wed Jan 27 19:41:46 2016 +0000

----------------------------------------------------------------------
 src/kudu/client/client_samples-test.sh | 23 ++++++++++++++++++++---
 src/kudu/client/samples/sample.cc      |  7 ++++++-
 2 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/de6df2e9/src/kudu/client/client_samples-test.sh
----------------------------------------------------------------------
diff --git a/src/kudu/client/client_samples-test.sh b/src/kudu/client/client_samples-test.sh
index f573207..6c8f5e7 100755
--- a/src/kudu/client/client_samples-test.sh
+++ b/src/kudu/client/client_samples-test.sh
@@ -87,6 +87,15 @@ CMAKE_PREFIX_PATH=$PREFIX_DIR $CMAKE .
 make -j$(getconf _NPROCESSORS_ONLN)
 popd
 
+# Pick a unique localhost IP address so this can run in parallel with other
+# tests. This only works on Linux.
+LOCALHOST_IP=127.0.0.1
+if [ "$(uname)" == "Linux" ]; then
+  LOCALHOST_IP=127.$[($$ >> 8) & 0xff].$[$$ & 0xff].1
+  echo Using unique localhost IP $LOCALHOST_IP
+fi
+
+
 # Start master+ts
 export TMPDIR=${TMPDIR:-/tmp}
 export TEST_TMPDIR=${TEST_TMPDIR:-$TMPDIR/kudutest-$UID}
@@ -95,16 +104,24 @@ BASE_DIR=$(mktemp -d $TEST_TMPDIR/client_samples-test.XXXXXXXX)
 $OUTPUT_DIR/kudu-master \
   --log_dir=$BASE_DIR \
   --fs_wal_dir=$BASE_DIR/master \
-  --fs_data_dirs=$BASE_DIR/master &
+  --fs_data_dirs=$BASE_DIR/master \
+  --webserver_interface=localhost \
+  --webserver_port=0 \
+  --rpc_bind_addresses=$LOCALHOST_IP &
 MASTER_PID=$!
 $OUTPUT_DIR/kudu-tserver \
   --log_dir=$BASE_DIR \
   --fs_wal_dir=$BASE_DIR/ts \
-  --fs_data_dirs=$BASE_DIR/ts &
+  --fs_data_dirs=$BASE_DIR/ts \
+  --rpc_bind_addresses=$LOCALHOST_IP \
+  --local_ip_for_outbound_sockets=$LOCALHOST_IP \
+  --webserver_interface=localhost \
+  --webserver_port=0 \
+  --tserver_master_addrs=$LOCALHOST_IP &
 TS_PID=$!
 
 # Let them run for a bit.
 sleep 5
 
 # Run the samples.
-$SAMPLES_DIR/sample
+$SAMPLES_DIR/sample $LOCALHOST_IP

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/de6df2e9/src/kudu/client/samples/sample.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/samples/sample.cc b/src/kudu/client/samples/sample.cc
index c2963ef..340d01c 100644
--- a/src/kudu/client/samples/sample.cc
+++ b/src/kudu/client/samples/sample.cc
@@ -234,6 +234,11 @@ int main(int argc, char* argv[]) {
   kudu::client::KuduLoggingFunctionCallback<void*> log_cb(&LogCb, NULL);
   kudu::client::InstallLoggingCallback(&log_cb);
 
+  if (argc != 2) {
+    KUDU_LOG(FATAL) << "usage: " << argv[0] << " <master host>";
+  }
+  const string master_host = argv[1];
+
   const string kTableName = "test_table";
 
   // Enable verbose debugging for the client library.
@@ -241,7 +246,7 @@ int main(int argc, char* argv[]) {
 
   // Create and connect a client.
   shared_ptr<KuduClient> client;
-  KUDU_CHECK_OK(CreateClient("127.0.0.1", &client));
+  KUDU_CHECK_OK(CreateClient(master_host, &client));
   KUDU_LOG(INFO) << "Created a client connection";
 
   // Disable the verbose logging.


Mime
View raw message