From aadb910524a62a816f334e1d5b1c74ee5d7f974c Mon Sep 17 00:00:00 2001
From: Sree Kuchibhotla <sreek@google.com>
Date: Fri, 26 Feb 2016 16:47:47 -0800
Subject: [PATCH] Change directory structure for the scripts (remove
 tools/big_query and tools/gke directies and instead create tools/gcp). Move
 scripts around in to the appropriate directories

---
 .../{run_tests => gcp}/stress_test/run_client.py |  0
 .../{run_tests => gcp}/stress_test/run_server.py |  0
 .../stress_test/stress_test_utils.py             |  2 +-
 .../{big_query => gcp/utils}/big_query_utils.py  |  0
 tools/{gke => gcp/utils}/kubernetes_api.py       |  0
 tools/jenkins/build_interop_stress_image.sh      |  2 +-
 .../stress_test}/run_stress_tests_on_gke.py      | 16 ++++++++--------
 7 files changed, 10 insertions(+), 10 deletions(-)
 rename tools/{run_tests => gcp}/stress_test/run_client.py (100%)
 rename tools/{run_tests => gcp}/stress_test/run_server.py (100%)
 rename tools/{run_tests => gcp}/stress_test/stress_test_utils.py (99%)
 rename tools/{big_query => gcp/utils}/big_query_utils.py (100%)
 rename tools/{gke => gcp/utils}/kubernetes_api.py (100%)
 rename tools/{gke => run_tests/stress_test}/run_stress_tests_on_gke.py (98%)

diff --git a/tools/run_tests/stress_test/run_client.py b/tools/gcp/stress_test/run_client.py
similarity index 100%
rename from tools/run_tests/stress_test/run_client.py
rename to tools/gcp/stress_test/run_client.py
diff --git a/tools/run_tests/stress_test/run_server.py b/tools/gcp/stress_test/run_server.py
similarity index 100%
rename from tools/run_tests/stress_test/run_server.py
rename to tools/gcp/stress_test/run_server.py
diff --git a/tools/run_tests/stress_test/stress_test_utils.py b/tools/gcp/stress_test/stress_test_utils.py
similarity index 99%
rename from tools/run_tests/stress_test/stress_test_utils.py
rename to tools/gcp/stress_test/stress_test_utils.py
index 7adc0068f9..c4b437e345 100755
--- a/tools/run_tests/stress_test/stress_test_utils.py
+++ b/tools/gcp/stress_test/stress_test_utils.py
@@ -39,7 +39,7 @@ import time
 
 # Import big_query_utils module
 bq_utils_dir = os.path.abspath(os.path.join(
-    os.path.dirname(__file__), '../../big_query'))
+    os.path.dirname(__file__), '../utils'))
 sys.path.append(bq_utils_dir)
 import big_query_utils as bq_utils
 
diff --git a/tools/big_query/big_query_utils.py b/tools/gcp/utils/big_query_utils.py
similarity index 100%
rename from tools/big_query/big_query_utils.py
rename to tools/gcp/utils/big_query_utils.py
diff --git a/tools/gke/kubernetes_api.py b/tools/gcp/utils/kubernetes_api.py
similarity index 100%
rename from tools/gke/kubernetes_api.py
rename to tools/gcp/utils/kubernetes_api.py
diff --git a/tools/jenkins/build_interop_stress_image.sh b/tools/jenkins/build_interop_stress_image.sh
index 4c8e998a8a..501dc5b7ca 100755
--- a/tools/jenkins/build_interop_stress_image.sh
+++ b/tools/jenkins/build_interop_stress_image.sh
@@ -79,7 +79,7 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)"
   $BASE_IMAGE \
   bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop_stress.sh \
   && docker commit $CONTAINER_NAME $INTEROP_IMAGE \
-  && ( if [ -n $INTEROP_IMAGE_REPOSITORY_TAG ]; then docker tag $INTEROP_IMAGE $INTEROP_IMAGE_REPOSITORY_TAG ; fi ) \
+  && ( if [ -n "$INTEROP_IMAGE_REPOSITORY_TAG" ]; then docker tag -f $INTEROP_IMAGE $INTEROP_IMAGE_REPOSITORY_TAG ; fi ) \
   && echo "Successfully built image $INTEROP_IMAGE")
 EXITCODE=$?
 
diff --git a/tools/gke/run_stress_tests_on_gke.py b/tools/run_tests/stress_test/run_stress_tests_on_gke.py
similarity index 98%
rename from tools/gke/run_stress_tests_on_gke.py
rename to tools/run_tests/stress_test/run_stress_tests_on_gke.py
index d126e3db43..634eb1aca5 100755
--- a/tools/gke/run_stress_tests_on_gke.py
+++ b/tools/run_tests/stress_test/run_stress_tests_on_gke.py
@@ -35,14 +35,18 @@ import sys
 import time
 
 stress_test_utils_dir = os.path.abspath(os.path.join(
-    os.path.dirname(__file__), '../run_tests/stress_test'))
+    os.path.dirname(__file__), '../../gcp/stress_test'))
 sys.path.append(stress_test_utils_dir)
 from stress_test_utils import BigQueryHelper
 
+kubernetes_api_dir = os.path.abspath(os.path.join(
+    os.path.dirname(__file__), '../../gcp/utils'))
+sys.path.append(kubernetes_api_dir)
+
 import kubernetes_api
 
 _GRPC_ROOT = os.path.abspath(os.path.join(
-    os.path.dirname(sys.argv[0]), '../..'))
+    os.path.dirname(sys.argv[0]), '../../..'))
 os.chdir(_GRPC_ROOT)
 
 # num of seconds to wait for the GKE image to start and warmup
@@ -214,9 +218,7 @@ def _launch_server(gke_settings, stress_server_settings, bq_settings,
 
   # This is the wrapper script that is run in the container. This script runs
   # the actual stress test server
-  server_cmd_list = [
-      '/var/local/git/grpc/tools/run_tests/stress_test/run_server.py'
-  ]
+  server_cmd_list = ['/var/local/git/grpc/tools/gcp/stress_test/run_server.py']
 
   # run_server.py does not take any args from the command line. The args are
   # instead passed via environment variables (see server_env below)
@@ -269,9 +271,7 @@ def _launch_client(gke_settings, stress_server_settings, stress_client_settings,
 
   # This is the wrapper script that is run in the container. This script runs
   # the actual stress client
-  client_cmd_list = [
-      '/var/local/git/grpc/tools/run_tests/stress_test/run_client.py'
-  ]
+  client_cmd_list = ['/var/local/git/grpc/tools/gcp/stress_test/run_client.py']
 
   # run_client.py takes no args. All args are passed as env variables (see
   # client_env)
-- 
GitLab