Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
test_resmon_plugin.cpp File Reference
#include <boost/test/included/unit_test.hpp>
#include <fc/variant_object.hpp>
#include <sysio/resource_monitor_plugin/resource_monitor_plugin.hpp>
#include <thread>
Include dependency graph for test_resmon_plugin.cpp:

Go to the source code of this file.

Classes

struct  resmon_fixture
 

Macros

#define BOOST_TEST_MODULE   test_resmom_plugin
 

Functions

 BOOST_FIXTURE_TEST_CASE (intervalTooBig, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (intervalTooSmall, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (intervalLowBound, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (intervalMiddle, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (intervalHighBound, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (thresholdTooBig, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (thresholdTooSmall, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (thresholdLowBound, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (thresholdMiddle, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (thresholdHighBound, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (noShutdown, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (startupNormal, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (startupDuplicateDirs, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (startupMultDirs, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (startupNoExistingDirs, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (startupLongRun, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (warningIntervalTooBig, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (warningIntervalTooSmall, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (warningIntervalLowBound, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (warningIntervalMiddle, resmon_fixture)
 
 BOOST_FIXTURE_TEST_CASE (warningIntervalHighBound, resmon_fixture)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   test_resmom_plugin

Definition at line 1 of file test_resmon_plugin.cpp.

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE() [1/21]

BOOST_FIXTURE_TEST_CASE ( intervalHighBound ,
resmon_fixture  )

Definition at line 86 of file test_resmon_plugin.cpp.

87 {
88 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-interval-seconds=300"}));
89 }

◆ BOOST_FIXTURE_TEST_CASE() [2/21]

BOOST_FIXTURE_TEST_CASE ( intervalLowBound ,
resmon_fixture  )

Definition at line 76 of file test_resmon_plugin.cpp.

77 {
78 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-interval-seconds=1"}));
79 }

◆ BOOST_FIXTURE_TEST_CASE() [3/21]

BOOST_FIXTURE_TEST_CASE ( intervalMiddle ,
resmon_fixture  )

Definition at line 81 of file test_resmon_plugin.cpp.

82 {
83 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-interval-seconds=150"}));
84 }

◆ BOOST_FIXTURE_TEST_CASE() [4/21]

BOOST_FIXTURE_TEST_CASE ( intervalTooBig ,
resmon_fixture  )

Definition at line 66 of file test_resmon_plugin.cpp.

67 {
68 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-interval-seconds=301"}), chain::plugin_config_exception);
69 }

◆ BOOST_FIXTURE_TEST_CASE() [5/21]

BOOST_FIXTURE_TEST_CASE ( intervalTooSmall ,
resmon_fixture  )

Definition at line 71 of file test_resmon_plugin.cpp.

72 {
73 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-interval-seconds=0"}), chain::plugin_config_exception);
74 }

◆ BOOST_FIXTURE_TEST_CASE() [6/21]

BOOST_FIXTURE_TEST_CASE ( noShutdown ,
resmon_fixture  )

Definition at line 116 of file test_resmon_plugin.cpp.

117 {
118 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-not-shutdown-on-threshold-exceeded"}));
119 }

◆ BOOST_FIXTURE_TEST_CASE() [7/21]

BOOST_FIXTURE_TEST_CASE ( startupDuplicateDirs ,
resmon_fixture  )

Definition at line 126 of file test_resmon_plugin.cpp.

127 {
128 BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp", "/tmp"}));
129 }

◆ BOOST_FIXTURE_TEST_CASE() [8/21]

BOOST_FIXTURE_TEST_CASE ( startupLongRun ,
resmon_fixture  )

Definition at line 143 of file test_resmon_plugin.cpp.

144 {
145 BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp"}, 120));
146 }

◆ BOOST_FIXTURE_TEST_CASE() [9/21]

BOOST_FIXTURE_TEST_CASE ( startupMultDirs ,
resmon_fixture  )

Definition at line 131 of file test_resmon_plugin.cpp.

132 {
133 // Under "/" are multiple file systems
134 BOOST_REQUIRE_NO_THROW( plugin_startup({"/", "/tmp"}));
135 }

◆ BOOST_FIXTURE_TEST_CASE() [10/21]

BOOST_FIXTURE_TEST_CASE ( startupNoExistingDirs ,
resmon_fixture  )

Definition at line 137 of file test_resmon_plugin.cpp.

138 {
139 // "hsdfgd983" a random file and not existing
140 BOOST_REQUIRE_THROW( plugin_startup({"/tmp", "hsdfgd983"}), chain::plugin_config_exception);
141 }

◆ BOOST_FIXTURE_TEST_CASE() [11/21]

BOOST_FIXTURE_TEST_CASE ( startupNormal ,
resmon_fixture  )

Definition at line 121 of file test_resmon_plugin.cpp.

122 {
123 BOOST_REQUIRE_NO_THROW( plugin_startup({"/tmp"}));
124 }

◆ BOOST_FIXTURE_TEST_CASE() [12/21]

BOOST_FIXTURE_TEST_CASE ( thresholdHighBound ,
resmon_fixture  )

Definition at line 111 of file test_resmon_plugin.cpp.

112 {
113 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-space-threshold=99"}));
114 }

◆ BOOST_FIXTURE_TEST_CASE() [13/21]

BOOST_FIXTURE_TEST_CASE ( thresholdLowBound ,
resmon_fixture  )

Definition at line 101 of file test_resmon_plugin.cpp.

102 {
103 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-space-threshold=6"}));
104 }

◆ BOOST_FIXTURE_TEST_CASE() [14/21]

BOOST_FIXTURE_TEST_CASE ( thresholdMiddle ,
resmon_fixture  )

Definition at line 106 of file test_resmon_plugin.cpp.

107 {
108 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-space-threshold=60"}));
109 }

◆ BOOST_FIXTURE_TEST_CASE() [15/21]

BOOST_FIXTURE_TEST_CASE ( thresholdTooBig ,
resmon_fixture  )

Definition at line 91 of file test_resmon_plugin.cpp.

92 {
93 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-space-threshold=100"}), chain::plugin_config_exception);
94 }

◆ BOOST_FIXTURE_TEST_CASE() [16/21]

BOOST_FIXTURE_TEST_CASE ( thresholdTooSmall ,
resmon_fixture  )

Definition at line 96 of file test_resmon_plugin.cpp.

97 {
98 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-space-threshold=5"}), chain::plugin_config_exception);
99 }

◆ BOOST_FIXTURE_TEST_CASE() [17/21]

BOOST_FIXTURE_TEST_CASE ( warningIntervalHighBound ,
resmon_fixture  )

Definition at line 168 of file test_resmon_plugin.cpp.

169 {
170 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-warning-interval=450"}));
171 }

◆ BOOST_FIXTURE_TEST_CASE() [18/21]

BOOST_FIXTURE_TEST_CASE ( warningIntervalLowBound ,
resmon_fixture  )

Definition at line 158 of file test_resmon_plugin.cpp.

159 {
160 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-warning-interval=1"}));
161 }

◆ BOOST_FIXTURE_TEST_CASE() [19/21]

BOOST_FIXTURE_TEST_CASE ( warningIntervalMiddle ,
resmon_fixture  )

Definition at line 163 of file test_resmon_plugin.cpp.

164 {
165 BOOST_REQUIRE_NO_THROW(set_options({"--resource-monitor-warning-interval=225"}));
166 }

◆ BOOST_FIXTURE_TEST_CASE() [20/21]

BOOST_FIXTURE_TEST_CASE ( warningIntervalTooBig ,
resmon_fixture  )

Definition at line 148 of file test_resmon_plugin.cpp.

149 {
150 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-warning-interval=451"}), chain::plugin_config_exception);
151 }

◆ BOOST_FIXTURE_TEST_CASE() [21/21]

BOOST_FIXTURE_TEST_CASE ( warningIntervalTooSmall ,
resmon_fixture  )

Definition at line 153 of file test_resmon_plugin.cpp.

154 {
155 BOOST_REQUIRE_THROW(set_options({"--resource-monitor-warning-interval=0"}), chain::plugin_config_exception);
156 }