Skip to content

Commit

Permalink
Update tests for new NTP configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fastiuk committed Nov 16, 2023
1 parent da905b2 commit 355f557
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/generic_config_updater/test_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ def ntp_server_tc1_add_config(duthost):
""" Test to add NTP_SERVER config
"""
json_patch = [
{
"op": "add",
"path": "/NTP_SERVER",
"value": {
NTP_SERVER_INIT: {
"resolve_as": NTP_SERVER_INIT,
"association_type": "server",
"iburst": "on"
}
}
}
]

json_patch_bc = [
{
"op": "add",
"path": "/NTP_SERVER",
Expand All @@ -118,6 +132,8 @@ def ntp_server_tc1_add_config(duthost):
try:
start_time = datetime.datetime.now()
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
if output['rc'] != 0:
output = apply_patch(duthost, json_data=json_patch_bc, dest_file=tmpfile)
expect_op_success(duthost, output)

pytest_assert(
Expand Down Expand Up @@ -169,6 +185,22 @@ def ntp_server_tc1_replace(duthost):
""" Test to replace ntp server
"""
json_patch = [
{
"op": "remove",
"path": "/NTP_SERVER/{}".format(NTP_SERVER_INIT)
},
{
"op": "add",
"path": "/NTP_SERVER/{}".format(NTP_SERVER_DUMMY),
"value": {
"resolve_as": NTP_SERVER_DUMMY,
"association_type": "server",
"iburst": "on"
}
}
]

json_patch_bc = [
{
"op": "remove",
"path": "/NTP_SERVER/{}".format(NTP_SERVER_INIT)
Expand All @@ -186,6 +218,8 @@ def ntp_server_tc1_replace(duthost):
try:
start_time = datetime.datetime.now()
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
if output['rc'] != 0:
output = apply_patch(duthost, json_data=json_patch_bc, dest_file=tmpfile)
expect_op_success(duthost, output)

pytest_assert(
Expand Down

0 comments on commit 355f557

Please sign in to comment.