Skip to content

Commit b1bf25e

Browse files
committed
smoketest: T6746: remove unneeded commit_guard time
It was an invalid workarround as the underlaying issue seems to be a race condition in CStore. The commit process is not finished until all pending files from VYATTA_CHANGES_ONLY_DIR are copied to VYATTA_ACTIVE_CONFIGURATION_DIR. This is done inside libvyatta-cfg1 and the FUSE UnionFS part. On large non-interactive commits FUSE UnionFS might not replicate the real state in time, leading to errors when querying the working and effective configuration. TO BE DELETED AFTER SWITCH TO IN MEMORY CONFIG
1 parent 71c0b2b commit b1bf25e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

smoketest/scripts/cli/base_vyostest_shim.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import pprint
1919

2020
from time import sleep
21-
from time import time
2221
from typing import Type
2322

2423
from vyos.configsession import ConfigSession
@@ -30,6 +29,14 @@
3029

3130
save_config = '/tmp/vyos-smoketest-save'
3231

32+
# The commit process is not finished until all pending files from
33+
# VYATTA_CHANGES_ONLY_DIR are copied to VYATTA_ACTIVE_CONFIGURATION_DIR. This
34+
# is done inside libvyatta-cfg1 and the FUSE UnionFS part. On large non-
35+
# interactive commits FUSE UnionFS might not replicate the real state in time,
36+
# leading to errors when querying the working and effective configuration.
37+
# TO BE DELETED AFTER SWITCH TO IN MEMORY CONFIG
38+
CSTORE_GUARD_TIME = 4
39+
3340
# This class acts as shim between individual Smoketests developed for VyOS and
3441
# the Python UnitTest framework. Before every test is loaded, we dump the current
3542
# system configuration and reload it after the test - despite the test results.
@@ -44,7 +51,6 @@ class TestCase(unittest.TestCase):
4451
# trigger the certain failure condition.
4552
# Use "self.debug = True" in derived classes setUp() method
4653
debug = False
47-
commit_guard = time()
4854
@classmethod
4955
def setUpClass(cls):
5056
cls._session = ConfigSession(os.getpid())
@@ -85,11 +91,12 @@ def cli_commit(self):
8591
if self.debug:
8692
print('commit')
8793
self._session.commit()
88-
# during a commit there is a process opening commit_lock, and run() returns 0
94+
# During a commit there is a process opening commit_lock, and run()
95+
# returns 0
8996
while run(f'sudo lsof -nP {commit_lock}') == 0:
9097
sleep(0.250)
91-
# reset getFRRconfig() guard timer
92-
self.commit_guard = time()
98+
# Wait for CStore completion for fast non-interactive commits
99+
sleep(CSTORE_GUARD_TIME)
93100

94101
def op_mode(self, path : list) -> None:
95102
"""
@@ -105,7 +112,7 @@ def op_mode(self, path : list) -> None:
105112
return out
106113

107114
def getFRRconfig(self, string=None, end='$', endsection='^!',
108-
substring=None, endsubsection=None, guard_time=10, empty_retry=0):
115+
substring=None, endsubsection=None, empty_retry=0):
109116
"""
110117
Retrieve current "running configuration" from FRR
111118
@@ -115,11 +122,6 @@ def getFRRconfig(self, string=None, end='$', endsection='^!',
115122
substring: search section under the result found by string
116123
endsubsection: end of the subsection (usually something with "exit")
117124
"""
118-
# Sometimes FRR needs some time after reloading the configuration to
119-
# appear in vtysh. This is a workaround addiung a 10 second guard timer
120-
# between the last cli_commit() and the first read of FRR config via vtysh
121-
while (time() - self.commit_guard) < guard_time:
122-
sleep(0.250) # wait 250 milliseconds
123125
command = f'vtysh -c "show run no-header"'
124126
if string:
125127
command += f' | sed -n "/^{string}{end}/,/{endsection}/p"'

0 commit comments

Comments
 (0)