From 83a9a6554d2e62de4e9b88d6ea58dd0d04c491c4 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla <sreek@google.com> Date: Mon, 4 Apr 2016 21:49:15 -0700 Subject: [PATCH] node wrapper --- tools/gcp/stress_test/run_node.sh | 37 +++++++++++++++++++ tools/run_tests/stress_test/configs/asan.json | 6 +-- tools/run_tests/stress_test/configs/node.json | 22 ++++++++--- .../stress_test/configs/opt-tsan-asan.json | 18 ++++----- tools/run_tests/stress_test/configs/opt.json | 6 +-- tools/run_tests/stress_test/configs/tsan.json | 6 +-- tools/run_tests/stress_test/run_on_gke.py | 25 +++++++------ 7 files changed, 85 insertions(+), 35 deletions(-) create mode 100755 tools/gcp/stress_test/run_node.sh diff --git a/tools/gcp/stress_test/run_node.sh b/tools/gcp/stress_test/run_node.sh new file mode 100755 index 0000000000..329a57e907 --- /dev/null +++ b/tools/gcp/stress_test/run_node.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This is a wrapper script that was created to help run_server.py and +# run_client.py to launch 'node js' stress clients and stress servers +source ~/.nvm/nvm.sh + +set -ex + +$@ diff --git a/tools/run_tests/stress_test/configs/asan.json b/tools/run_tests/stress_test/configs/asan.json index 7414829da8..e17077b7d5 100644 --- a/tools/run_tests/stress_test/configs/asan.json +++ b/tools/run_tests/stress_test/configs/asan.json @@ -29,8 +29,8 @@ "templates": { "cxx_client_asan": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/asan/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/asan/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/asan/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/asan/metrics_client"] } } }, @@ -48,7 +48,7 @@ "templates": { "cxx_server_asan": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/asan/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/asan/interop_server"] } } }, diff --git a/tools/run_tests/stress_test/configs/node.json b/tools/run_tests/stress_test/configs/node.json index 525f9031b3..0c5262a78a 100644 --- a/tools/run_tests/stress_test/configs/node.json +++ b/tools/run_tests/stress_test/configs/node.json @@ -27,8 +27,16 @@ "templates": { "node_client": { "baseTemplate": "default", - "stressClientCmd": "node /var/local/git/grpc/src/node/stress/stress_client.js", - "metricsClientCmd": "node /var/local/git/grpc/src/node/stress/metrics_client.js" + "stressClientCmd": [ + "/var/local/git/grpc/tools/gcp/stress_test/run_node.sh", + "node", + "/var/local/git/grpc/src/node/stress/stress_client.js" + ], + "metricsClientCmd": [ + "/var/local/git/grpc/tools/gcp/stress_test/run_node.sh", + "node", + "/var/local/git/grpc/src/node/stress/metrics_client.js" + ] } } }, @@ -46,7 +54,11 @@ "templates": { "node_server": { "baseTemplate": "default", - "stressServerCmd": "node /var/local/git/grpc/src/node/interop/interop_server.js" + "stressServerCmd": [ + "/var/local/git/grpc/tools/gcp/stress_test/run_node.sh", + "node", + "/var/local/git/grpc/src/node/interop/interop_server.js" + ] } } }, @@ -64,7 +76,7 @@ "node-stress-client": { "clientTemplate": "node_client", "dockerImage": "grpc_stress_node", - "numInstances": 1, + "numInstances": 2, "serverPodSpec": "node-stress-server" } } @@ -73,7 +85,7 @@ "globalSettings": { "buildDockerImages": false, "pollIntervalSecs": 10, - "testDurationSecs": 60, + "testDurationSecs": 120, "kubernetesProxyPort": 8001, "datasetIdNamePrefix": "stress_test_node", "summaryTableId": "summary", diff --git a/tools/run_tests/stress_test/configs/opt-tsan-asan.json b/tools/run_tests/stress_test/configs/opt-tsan-asan.json index 30a256de7b..b49683a014 100644 --- a/tools/run_tests/stress_test/configs/opt-tsan-asan.json +++ b/tools/run_tests/stress_test/configs/opt-tsan-asan.json @@ -39,18 +39,18 @@ "templates": { "cxx_client_opt": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/opt/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/opt/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/opt/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/opt/metrics_client"] }, "cxx_client_tsan": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/tsan/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/tsan/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/tsan/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/tsan/metrics_client"] }, "cxx_client_asan": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/asan/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/asan/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/asan/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/asan/metrics_client"] } } }, @@ -68,15 +68,15 @@ "templates": { "cxx_server_opt": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/opt/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/opt/interop_server"] }, "cxx_server_tsan": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/tsan/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/tsan/interop_server"] }, "cxx_server_asan": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/asan/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/asan/interop_server"] } } }, diff --git a/tools/run_tests/stress_test/configs/opt.json b/tools/run_tests/stress_test/configs/opt.json index 1cedb922b3..ae8c00a36d 100644 --- a/tools/run_tests/stress_test/configs/opt.json +++ b/tools/run_tests/stress_test/configs/opt.json @@ -29,8 +29,8 @@ "templates": { "cxx_client_opt": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/opt/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/opt/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/opt/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/opt/metrics_client"] } } }, @@ -48,7 +48,7 @@ "templates": { "cxx_server_opt": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/opt/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/opt/interop_server"] } } }, diff --git a/tools/run_tests/stress_test/configs/tsan.json b/tools/run_tests/stress_test/configs/tsan.json index 7e91389230..8d8c954099 100644 --- a/tools/run_tests/stress_test/configs/tsan.json +++ b/tools/run_tests/stress_test/configs/tsan.json @@ -29,8 +29,8 @@ "templates": { "cxx_client_tsan": { "baseTemplate": "default", - "stressClientCmd": "/var/local/git/grpc/bins/tsan/stress_test", - "metricsClientCmd": "/var/local/git/grpc/bins/tsan/metrics_client" + "stressClientCmd": ["/var/local/git/grpc/bins/tsan/stress_test"], + "metricsClientCmd": ["/var/local/git/grpc/bins/tsan/metrics_client"] } } }, @@ -48,7 +48,7 @@ "templates": { "cxx_server_tsan": { "baseTemplate": "default", - "stressServerCmd": "/var/local/git/grpc/bins/tsan/interop_server" + "stressServerCmd": ["/var/local/git/grpc/bins/tsan/interop_server"] } } }, diff --git a/tools/run_tests/stress_test/run_on_gke.py b/tools/run_tests/stress_test/run_on_gke.py index 47c9725af3..50ac05c7b4 100755 --- a/tools/run_tests/stress_test/run_on_gke.py +++ b/tools/run_tests/stress_test/run_on_gke.py @@ -67,9 +67,9 @@ class GlobalSettings: class ClientTemplate: """ Contains all the common settings that are used by a stress client """ - def __init__(self, name, stress_client_cmd, metrics_client_cmd, - metrics_port, wrapper_script_path, poll_interval_secs, - client_args_dict, metrics_args_dict): + def __init__(self, name, stress_client_cmd, metrics_client_cmd, metrics_port, + wrapper_script_path, poll_interval_secs, client_args_dict, + metrics_args_dict): self.name = name self.stress_client_cmd = stress_client_cmd self.metrics_client_cmd = metrics_client_cmd @@ -285,8 +285,7 @@ class Gke: 'STRESS_TEST_CMD': client_pod_spec.template.stress_client_cmd, 'STRESS_TEST_ARGS_STR': self._args_dict_to_str( client_pod_spec.get_client_args_dict()), - 'METRICS_CLIENT_CMD': - client_pod_spec.template.metrics_client_cmd, + 'METRICS_CLIENT_CMD': client_pod_spec.template.metrics_client_cmd, 'METRICS_CLIENT_ARGS_STR': self._args_dict_to_str( client_pod_spec.template.metrics_args_dict), 'POLL_INTERVAL_SECS': str(client_pod_spec.template.poll_interval_secs) @@ -416,11 +415,13 @@ class Config: temp_dict.update(templates_dict[template_name]) # Create and add ClientTemplate object to the final client_templates_dict + stress_client_cmd = ' '.join(temp_dict['stressClientCmd']) + metrics_client_cmd = ' '.join(temp_dict['metricsClientCmd']) client_templates_dict[template_name] = ClientTemplate( - template_name, temp_dict['stressClientCmd'], - temp_dict['metricsClientCmd'], temp_dict['metricsPort'], - temp_dict['wrapperScriptPath'], temp_dict['pollIntervalSecs'], - temp_dict['clientArgs'].copy(), temp_dict['metricsArgs'].copy()) + template_name, stress_client_cmd, metrics_client_cmd, + temp_dict['metricsPort'], temp_dict['wrapperScriptPath'], + temp_dict['pollIntervalSecs'], temp_dict['clientArgs'].copy(), + temp_dict['metricsArgs'].copy()) return client_templates_dict @@ -452,10 +453,10 @@ class Config: temp_dict.update(templates_dict[template_name]) # Create and add ServerTemplate object to the final server_templates_dict + stress_server_cmd = ' '.join(temp_dict['stressServerCmd']) server_templates_dict[template_name] = ServerTemplate( - template_name, temp_dict['stressServerCmd'], - temp_dict['wrapperScriptPath'], temp_dict['serverPort'], - temp_dict['serverArgs'].copy()) + template_name, stress_server_cmd, temp_dict['wrapperScriptPath'], + temp_dict['serverPort'], temp_dict['serverArgs'].copy()) return server_templates_dict -- GitLab