From f7c1737593cf4b2f506ba695903de567d011dfb0 Mon Sep 17 00:00:00 2001 From: Dawei Huang Date: Wed, 29 Apr 2026 22:20:39 -0500 Subject: [PATCH] [conditional_mark] Skip gnmi/test_gnmic.py (#24329) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a conditional-mark `skip` for `tests/gnmi/test_gnmic.py` while the `gnmic` binary is being removed from `docker-ptf`. This is a precondition for the companion `docker-ptf` change that drops `gnmic` from the image. `tests/gnmi/test_gnmic.py` is the only test in this repo that invokes `/usr/local/bin/gnmic` directly (via `PtfGnmic.capabilities()`); without this skip, that test would start failing on the next `docker-ptf` rebuild. Fixes # (issue): sonic-net/sonic-mgmt#24328 - [x] Test case (verification of existing or new feature) - [ ] Request back port to applicable release branches (master only — no behavior change for release branches that don't run this test) Reduce `docker-ptf` supply-chain surface. `gnoic` was removed in [sonic-buildimage#27055](https://github.com/sonic-net/sonic-buildimage/pull/27055); `gnmic` is the next candidate because it has only one consumer in sonic-mgmt and that consumer can be skipped without losing coverage of any production behavior — `gnmi_tls.gnoi.*` and `pygnmi` cover the actual gNMI/gNOI surfaces under test. Added an entry under the `gnmi/` section of `tests_mark_conditions.yaml` that skips the test while sonic-net/sonic-mgmt#24328 is open. When the issue closes, the skip lifts — by then we should have either deleted the test outright or restored `gnmic`. - `yaml.safe_load` parses the file cleanly with the new entry present. - conditional_mark plugin uses `pytest_collection_modifyitems`; no test execution required to confirm marker application — the existing `unit_test/` suite under `tests/common/plugins/conditional_mark/` covers that mechanism. None. N/A — no test added. N/A. Signed-off-by: Dawei Huang --- .../plugins/conditional_mark/tests_mark_conditions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml index d364e08108c..09d33c6f0d4 100644 --- a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml +++ b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml @@ -2624,6 +2624,12 @@ gnmi/test_gnmi_countersdb.py::test_gnmi_queue_buffer_cnt: - "is_mgmt_ipv6_only==True" - "https://github.com/sonic-net/sonic-mgmt/issues/20395" +gnmi/test_gnmic.py: + skip: + reason: "gnmic binary is being removed from docker-ptf to reduce attack surface" + conditions: + - "https://github.com/sonic-net/sonic-mgmt/issues/24328" + gnmi/test_gnoi_killprocess.py: skip: reason: "Test noisy due to restart issue not relevant to GNOI. Disabling them to rewrite."