Skip to content

Commit

Permalink
Fix monitor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
badrogger committed Oct 26, 2022
1 parent 061d9b8 commit b9bbfd6
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tests/schains/monitor/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ def checks(


@pytest.fixture
def bad_checks(schain_db, _schain_name, rule_controller, node_config, ima_data):
def bad_checks(
schain_db,
_schain_name,
rule_controller,
node_config,
ima_data,
dutils
):
schain_record = upsert_schain_record(schain_db)
return SChainChecksMockBad(
_schain_name,
node_config.id,
schain_record,
rule_controller=rule_controller
rule_controller=rule_controller,
dutils=dutils
)


Expand Down Expand Up @@ -139,23 +147,25 @@ def test_is_reload_mode(schain_db, checks, bad_checks, skaled_status_reload):
assert get_monitor_type(schain_record, bad_checks, False, skaled_status_reload) == ReloadMonitor


def test_run_monitor_for_schain(skale, skale_ima, node_config, schain_db):
def test_run_monitor_for_schain(skale, skale_ima, node_config, schain_db, dutils):
with mock.patch('core.schains.monitor.main.RegularMonitor', CrashingTestMonitor), \
mock.patch('core.schains.monitor.main.is_node_part_of_chain', return_value=True):
assert not run_monitor_for_schain(
skale,
skale_ima,
node_config,
{'name': schain_db, 'partOfNode': 0, 'generation': 0},
once=True
once=True,
dutils=dutils
)
with mock.patch('core.schains.monitor.main.RegularMonitor', BaseTestMonitor):
assert run_monitor_for_schain(
skale,
skale_ima,
node_config,
{'name': schain_db, 'partOfNode': 0, 'generation': 0},
once=True
once=True,
dutils=dutils
)


Expand Down

0 comments on commit b9bbfd6

Please sign in to comment.