62 {
63 mock_get_space = [ i = 0, num_loops ](
const bfs::path&
p, boost::system::error_code& ec)
mutable -> bfs::space_info {
64 ec = boost::system::errc::make_error_code(errc::success);
65
67 rc.capacity = 1000000;
68
69 if ( i < num_loops + 1 ) {
70 rc.available = 300000;
71 } else {
72 rc.available = 100000;
73 }
74
75 i++;
76
78 };
79
82 return 0;
83 };
84
89
90 auto start = std::chrono::system_clock::now();
91
92 auto monitor_thread = std::thread( [this] {
95 });
96
97 monitor_thread.join();
98
99 auto end = std::chrono::system_clock::now();
100 std::chrono::duration<double> test_duration = end -
start;
101
102
103
104
105
106 bool finished_in_time = (test_duration >= std::chrono::duration<double>((num_loops - 1) * interval));
107
108 return finished_in_time;
109 }
wraps boost::filesystem::path to provide platform independent path manipulation.
std::function< bfs::space_info(const bfs::path &p, boost::system::error_code &ec)> mock_get_space
void set_threshold(uint32_t threshold, uint32_t warning_threshold)
void set_sleep_time(uint32_t sleep_time)
void set_shutdown_on_exceeded(bool shutdown_on_exceeded)
void add_file_system(const bfs::path &path_name)
std::function< int(const char *path, struct stat *buf)> mock_get_stat
void space_monitor_loop()