Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
add_file_system_fixture Struct Reference
Collaboration diagram for add_file_system_fixture:

Classes

struct  mock_space_provider
 

Public Types

using file_space_handler_t = file_space_handler<mock_space_provider>
 

Public Member Functions

 add_file_system_fixture ()
 
void add_file_system (const bfs::path &path_name)
 
void set_threshold (uint32_t threshold, uint32_t warning_threshold)
 
bool is_threshold_exceeded ()
 
void test_add_file_systems_common (std::vector< int > &capacity, std::vector< int > &available, std::vector< int > &devs)
 

Public Attributes

boost::asio::io_context ctx
 
std::function< bfs::space_info(const bfs::path &p, boost::system::error_code &ec)> mock_get_space
 
std::function< int(const char *path, struct stat *buf)> mock_get_stat
 
file_space_handler_t space_handler
 

Detailed Description

Definition at line 12 of file test_add_file_system.cpp.

Member Typedef Documentation

◆ file_space_handler_t

Constructor & Destructor Documentation

◆ add_file_system_fixture()

add_file_system_fixture::add_file_system_fixture ( )
inline

Definition at line 32 of file test_add_file_system.cpp.

33 : space_handler(mock_space_provider(*this), ctx)
34 {
35 }
file_space_handler_t space_handler
boost::asio::io_context ctx

Member Function Documentation

◆ add_file_system()

void add_file_system_fixture::add_file_system ( const bfs::path & path_name)
inline

Definition at line 37 of file test_add_file_system.cpp.

37 {
39 }
void add_file_system(const bfs::path &path_name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_threshold_exceeded()

bool add_file_system_fixture::is_threshold_exceeded ( )
inline

Definition at line 45 of file test_add_file_system.cpp.

Here is the call graph for this function:

◆ set_threshold()

void add_file_system_fixture::set_threshold ( uint32_t threshold,
uint32_t warning_threshold )
inline

Definition at line 41 of file test_add_file_system.cpp.

41 {
42 space_handler.set_threshold( threshold, warning_threshold );
43 }
void set_threshold(uint32_t new_threshold, uint32_t new_warning_threshold)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_add_file_systems_common()

void add_file_system_fixture::test_add_file_systems_common ( std::vector< int > & capacity,
std::vector< int > & available,
std::vector< int > & devs )
inline

Definition at line 49 of file test_add_file_system.cpp.

49 {
50 mock_get_space = [ i = 0, capacity, available ]( const bfs::path& p, boost::system::error_code& ec) mutable -> bfs::space_info {
51 ec = boost::system::errc::make_error_code(errc::success);
52
53 bfs::space_info rc;
54 rc.capacity = capacity[i];
55 rc.available = available[i];
56 i++;
57
58 return rc;
59 };
60
61 mock_get_stat = [ j = 0, devs ]( const char *path, struct stat *buf ) mutable -> int {
62 buf->st_dev = devs[j];
63 j++;
64
65 return 0;
66 };
67
68 set_threshold(80, 75);
69
70 for (size_t k = 0; k < capacity.size(); k++) {
71 add_file_system("/test" + std::to_string(k));
72 }
73 }
const mie::Vuint & p
Definition bn.cpp:27
wraps boost::filesystem::path to provide platform independent path manipulation.
void add_file_system(const bfs::path &path_name)
std::function< int(const char *path, struct stat *buf)> mock_get_stat
void set_threshold(uint32_t threshold, uint32_t warning_threshold)
std::function< bfs::space_info(const bfs::path &p, boost::system::error_code &ec)> mock_get_space
uint16_t j
uint8_t buf[2048]
yh_rc rc
Here is the call graph for this function:

Member Data Documentation

◆ ctx

boost::asio::io_context add_file_system_fixture::ctx

Definition at line 29 of file test_add_file_system.cpp.

◆ mock_get_space

std::function<bfs::space_info(const bfs::path& p, boost::system::error_code& ec)> add_file_system_fixture::mock_get_space

Definition at line 76 of file test_add_file_system.cpp.

◆ mock_get_stat

std::function<int(const char *path, struct stat *buf)> add_file_system_fixture::mock_get_stat

Definition at line 77 of file test_add_file_system.cpp.

◆ space_handler

file_space_handler_t add_file_system_fixture::space_handler

Definition at line 79 of file test_add_file_system.cpp.


The documentation for this struct was generated from the following file: