Skip to content

Commit

Permalink
Add unit test for pfcwd interval (#259)
Browse files Browse the repository at this point in the history
Why I did it
GCU has verified pfcwd interval config, we need to verify that GNMI can support the same pfcwd interval config.
Microsoft ADO: 27231852

How I did it
This unit test uses pfcwd interval config from GCU test.
This unit test generates GNMI request for pfcwd interval config and use jsonpatch to verify patch file generated by GNMI server.

How to verify it
Run GNMI unit test.
  • Loading branch information
ganglyu authored Jun 21, 2024
1 parent 0bbb9ef commit 65a43bc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/test_gnmi_configdb_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2619,6 +2619,31 @@ def create_checkpoint(file_name, text):
}
]

test_data_pfcwd_interval_patch = [
{
"test_name": "test_pfcwd_interval_config_updates",
"operations": [
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/PFC_WD/GLOBAL/POLL_INTERVAL",
"value": "800"
}
],
"origin_json": {
"PFC_WD": {
"GLOBAL": {}
}
},
"target_json": {
"PFC_WD": {
"GLOBAL": {
"POLL_INTERVAL": "800"
}
}
}
}
]

class TestGNMIConfigDbPatch:

def common_test_handler(self, test_data):
Expand Down Expand Up @@ -2775,3 +2800,10 @@ def test_gnmi_monitor_config_patch(self, test_data):
Generate GNMI request for monitor config and verify jsonpatch
'''
self.common_test_handler(test_data)

@pytest.mark.parametrize("test_data", test_data_pfcwd_interval_patch)
def test_gnmi_pfcwd_interval_patch(self, test_data):
'''
Generate GNMI request for pfcwd interval and verify jsonpatch
'''
self.common_test_handler(test_data)

0 comments on commit 65a43bc

Please sign in to comment.