Skip to content

Commit 7aa3729

Browse files
committed
modify uts to check if path exists
1 parent 329830f commit 7aa3729

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sonic-bgpcfgd/tests/test_bgp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def test_del_handler(mocked_log_info):
249249
def test_del_handler_dynamic_template_exists(mocked_log_info):
250250
for constant in load_constant_files():
251251
m = constructor(constant, peer_type="dynamic")
252-
mocked_log_info.assert_called_with("Using delete template found at %s" % "bgpd/templates/dynamic/delete.conf.j2")
252+
if os.path.exists(TEMPLATE_PATH + "/bgpd/templates/dynamic/delete.conf.j2"):
253+
mocked_log_info.assert_called_with("Using delete template found at %s" % "bgpd/templates/dynamic/delete.conf.j2")
253254
m.del_handler("10.10.10.1")
254255
mocked_log_info.assert_called_with("Peer '(default|10.10.10.1)' has been removed")
255256

@@ -265,6 +266,7 @@ def test_del_handler_nonexist_peer(mocked_log_warn):
265266
def test_del_handler_dynamic_nonexist_peer_template_exists(mocked_log_warn, mocked_log_info):
266267
for constant in load_constant_files():
267268
m = constructor(constant, peer_type="dynamic")
268-
mocked_log_info.assert_called_with("Using delete template found at %s" % "bgpd/templates/dynamic/delete.conf.j2")
269+
if os.path.exists(TEMPLATE_PATH + "/bgpd/templates/dynamic/delete.conf.j2"):
270+
mocked_log_info.assert_called_with("Using delete template found at %s" % "bgpd/templates/dynamic/delete.conf.j2")
269271
m.del_handler("40.40.40.1")
270272
mocked_log_warn.assert_called_with("Peer '(default|40.40.40.1)' has not been found")

0 commit comments

Comments
 (0)