From 8c5821a6fd55742de3b78c96feafd79d53103a36 Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Mon, 6 Mar 2023 16:14:08 +0800 Subject: [PATCH] Improve gnmi setup (#7646) What is the motivation for this PR? If gnmi program is running, no need to restart. How did you do it? Check program status, return for running state. How did you verify/test it? Run GNMI end2end test --- tests/gnmi/helper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/gnmi/helper.py b/tests/gnmi/helper.py index 511903092d..3fa07686b1 100644 --- a/tests/gnmi/helper.py +++ b/tests/gnmi/helper.py @@ -42,6 +42,10 @@ def apply_cert_config(duthost): def recover_cert_config(duthost): + dut_command = "docker exec %s supervisorctl status %s" % (GNMI_CONTAINER_NAME, GNMI_PROGRAM_NAME) + output = duthost.command(dut_command, module_ignore_errors=True)['stdout'].strip() + if 'RUNNING' in output: + return dut_command = "docker exec %s pkill telemetry" % (GNMI_CONTAINER_NAME) duthost.shell(dut_command, module_ignore_errors=True) dut_command = "docker exec %s supervisorctl start %s" % (GNMI_CONTAINER_NAME, GNMI_PROGRAM_NAME)