Browse code

Support debugging networking tests with delve

Maru Newby authored on 2015/12/05 08:27:22
Showing 2 changed files
... ...
@@ -316,6 +316,12 @@ NETWORKING_E2E_FOCUS and NETWORKING_E2E_SKIP environment variables.
316 316
 These variables set the '-focus' and '-skip' arguments supplied to the
317 317
 https://github.com/onsi/ginkgo[ginkgo] test runner.
318 318
 
319
+To debug a test run with https://github.com/derekparker/delve[delve],
320
+make sure the dlv executable is installed in your path and run the
321
+tests with NETWORKING_DEBUG set to true:
322
+
323
+        $ NETWORKING_DEBUG=true test/extended/networking.sh
324
+
319 325
 ==== Running networking tests against any cluster
320 326
 
321 327
 It's possible to run networking tests against any cluster.  To target
... ...
@@ -21,6 +21,8 @@ source "${OS_ROOT}/hack/common.sh"
21 21
 source "${OS_ROOT}/hack/lib/log.sh"
22 22
 os::log::install_errexit
23 23
 
24
+NETWORKING_DEBUG=${NETWORKING_DEBUG:-false}
25
+
24 26
 # These strings filter the available tests.
25 27
 NETWORKING_E2E_FOCUS="${NETWORKING_E2E_FOCUS:-etworking|Services}"
26 28
 NETWORKING_E2E_SKIP="${NETWORKING_E2E_SKIP:-}"
... ...
@@ -154,8 +156,15 @@ function run-extended-tests() {
154 154
   export KUBECONFIG="${config_root}/openshift.local.config/master/admin.kubeconfig"
155 155
   export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
156 156
 
157
-  local test_cmd="${TEST_BINARY} --test.v '--ginkgo.skip=${skip_regex}' \
157
+  local test_args="--test.v '--ginkgo.skip=${skip_regex}' \
158 158
 '--ginkgo.focus=${focus_regex}' ${TEST_EXTRA_ARGS}"
159
+
160
+  if [ "${NETWORKING_DEBUG}" = 'true' ]; then
161
+    local test_cmd="dlv exec ${TEST_BINARY} -- ${test_args}"
162
+  else
163
+    local test_cmd="${TEST_BINARY} ${test_args}"
164
+  fi
165
+
159 166
   if [ "${log_path}" != "" ]; then
160 167
     test_cmd="${test_cmd} | tee ${log_path}"
161 168
   fi