diff --git a/tools/ktest/namespace.py b/tools/ktest/namespace.py index 3f90186..1435909 100644 --- a/tools/ktest/namespace.py +++ b/tools/ktest/namespace.py @@ -96,14 +96,21 @@ def forward(self, svc: str, ports: Mapping[int, int]): yield proc finally: logger.debug("terminating port-forward: %s", svc) - for stop in (proc.terminate, proc.kill): + + def ctrl_c(): + proc.send_signal(signal.SIGINT) + + for stop in (ctrl_c, proc.terminate, proc.kill): logger.debug("attempting to '%s' port-forward: %s", stop.__name__, svc) stop() try: - proc.communicate(timeout=3) + outs, errs = proc.communicate(timeout=3) logger.debug("port-forward exited: %s", svc) + logger.debug("stdout: %s", outs) + logger.debug("stderr: %s", errs) + # wait for the port to become available again - time.sleep(3) + time.sleep(5) break except subprocess.TimeoutExpired: logger.info("timeout expired waiting for: %s", svc)