Skip to content

Commit

Permalink
Merge branch 'release/5.0' of github.com:AntelopeIO/leap into gh_1764
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Oct 26, 2023
2 parents 1e69568 + fcb6525 commit 9b2a981
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 9b2a981

Please sign in to comment.