Skip to content

Commit

Permalink
Revert "[route_check] remove check-frr_patch mock (sonic-net#2732)"
Browse files Browse the repository at this point in the history
This reverts commit f27dea0.
  • Loading branch information
StormLiangMS committed Mar 28, 2023
1 parent 824680e commit 4dcd582
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/route_check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,17 @@ def test_route_check(self, mock_dbs, test_num):
with patch('sys.argv', ct_data[ARGS].split()), \
patch('route_check.subprocess.check_output') as mock_check_output:

routes = ct_data.get(FRR_ROUTES, {})
check_frr_patch = patch('route_check.check_frr_pending_routes', lambda: [])

def side_effect(*args, **kwargs):
return json.dumps(routes)
if FRR_ROUTES in ct_data:
routes = ct_data[FRR_ROUTES]

mock_check_output.side_effect = side_effect
def side_effect(*args, **kwargs):
return json.dumps(routes)

mock_check_output.side_effect = side_effect
else:
check_frr_patch.start()

ret, res = route_check.main()
expect_ret = ct_data[RET] if RET in ct_data else 0
Expand All @@ -294,6 +299,8 @@ def side_effect(*args, **kwargs):
assert ret == expect_ret
assert res == expect_res

check_frr_patch.stop()

def test_timeout(self, mock_dbs, force_hang):
# Test timeout
ex_raised = False
Expand Down

0 comments on commit 4dcd582

Please sign in to comment.