Skip to content

Commit 7911598

Browse files
wumiaontmssonicbld
authored andcommitted
Fix: Fix NTP config long jump test failure issue (#13671)
The restart command needs to be run using root privilege.
1 parent 6929d1f commit 7911598

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,6 @@ ntp/test_ntp.py::test_ntp:
889889
conditions:
890890
- https://github.com/sonic-net/sonic-buildimage/issues/19425
891891

892-
ntp/test_ntp.py::test_ntp_long_jump_disabled:
893-
# Due to NTP code bug, long jump will still happen after disable it.
894-
# Set xfail flag for this test case
895-
xfail:
896-
strict: True
897-
reason: "Known NTP bug"
898-
899892
#######################################
900893
##### pc #####
901894
#######################################

tests/ntp/test_ntp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def config_long_jump(duthost, enable=False):
3939
regex = "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/"
4040

4141
if using_ntpsec:
42-
duthost.command("sed -i '%s' /etc/default/ntpsec" % regex)
42+
duthost.command("sudo sed -i '%s' /etc/default/ntpsec" % regex)
4343
else:
44-
duthost.command("sed -i %s /etc/default/ntp" % regex)
44+
duthost.command("sudo sed -i %s /etc/default/ntp" % regex)
4545
duthost.service(name='ntp', state='restarted')
4646

4747

@@ -148,8 +148,8 @@ def test_ntp_long_jump_disabled(duthosts, rand_one_dut_hostname, setup_ntp, setu
148148

149149
config_long_jump(duthost, enable=False)
150150

151-
if wait_until(720, 10, 0, check_ntp_status, duthost):
152-
pytest.fail("NTP long jump disable failed")
151+
pytest_assert(wait_until(720, 10, 0, check_ntp_status, duthost),
152+
"NTP long jump disable failed")
153153

154154

155155
def run_ntp(duthosts, rand_one_dut_hostname, setup_ntp):

0 commit comments

Comments
 (0)