Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/5.0' into resmon_determi…
Browse files Browse the repository at this point in the history
…nistic_tests_main
  • Loading branch information
linh2931 committed Oct 26, 2023
2 parents 5fe528f + fcb6525 commit f3f5890
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions plugins/resource_monitor_plugin/test/test_resmon_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,31 @@ BOOST_AUTO_TEST_SUITE(resmon_plugin_tests)

BOOST_FIXTURE_TEST_CASE(startupNormal, resmon_fixture)
{
BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp"}));
// do not use native "/tmp", as subdirectories in /tmp on test machine
// can be removed during a test run, causing file_space_handler::add_file_system
// to assert when doing get_stat on a removed directory
fc::temp_directory temp_dir;
BOOST_REQUIRE_NO_THROW(plugin_startup({temp_dir.path()}));
}

BOOST_FIXTURE_TEST_CASE(startupDuplicateDirs, resmon_fixture)
{
BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp", "/tmp"}));
fc::temp_directory temp_dir;
BOOST_REQUIRE_NO_THROW(plugin_startup({temp_dir.path(), temp_dir.path()}));
}

BOOST_FIXTURE_TEST_CASE(startupMultDirs, resmon_fixture)
{
// Under "/" are multiple file systems
BOOST_REQUIRE_NO_THROW( plugin_startup({"/", "/tmp"}));
fc::temp_directory temp_dir_1;
fc::temp_directory temp_dir_2;
BOOST_REQUIRE_NO_THROW(plugin_startup({temp_dir_1.path(), temp_dir_2.path()}));
}

BOOST_FIXTURE_TEST_CASE(startupNoExistingDirs, resmon_fixture)
{
// "hsdfgd983" a random file and not existing
BOOST_REQUIRE_THROW( plugin_startup({"/tmp", "hsdfgd983"}), chain::plugin_config_exception);
}

BOOST_FIXTURE_TEST_CASE(startupLongRun, resmon_fixture)
{
BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp"}, 5));
fc::temp_directory temp_dir;
// temp_dir/hsdfgd983 does not exist in a just created temp directory
BOOST_REQUIRE_THROW(plugin_startup({temp_dir.path(), temp_dir.path() / "hsdfgd983"}), chain::plugin_config_exception);
}

BOOST_FIXTURE_TEST_CASE(warningIntervalTooBig, resmon_fixture)
Expand Down

0 comments on commit f3f5890

Please sign in to comment.