Documentation
¶
Overview ¶
Package psutiltest provides mock implementations of the psutil interfaces for testing. It is a separate package to keep the mocks and their testing dependencies out of the shipped binary.
Index ¶
- type MockDiskUsage
- type MockPS
- func (m *MockPS) CPUTimes(_, _ bool) ([]cpu.TimesStat, error)
- func (m *MockPS) DiskIO(_ []string) (map[string]disk.IOCountersStat, error)
- func (m *MockPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
- func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
- func (m *MockPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
- func (m *MockPS) NetIO() ([]net.IOCountersStat, error)
- func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)
- func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)
- func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)
- type MockPSDisk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockDiskUsage ¶
MockDiskUsage is a mock implementation for disk usage operations.
func (*MockDiskUsage) OSGetenv ¶
func (m *MockDiskUsage) OSGetenv(key string) string
OSGetenv returns the value of the environment variable named by the key.
func (*MockDiskUsage) OSStat ¶
func (m *MockDiskUsage) OSStat(name string) (os.FileInfo, error)
OSStat returns the FileInfo structure describing the named file.
func (*MockDiskUsage) PSDiskUsage ¶
func (m *MockDiskUsage) PSDiskUsage(path string) (*disk.UsageStat, error)
PSDiskUsage returns a file system usage for the specified path.
func (*MockDiskUsage) Partitions ¶
func (m *MockDiskUsage) Partitions(all bool) ([]disk.PartitionStat, error)
Partitions returns the disk partition statistics.
type MockPS ¶
type MockPS struct {
mock.Mock
psutil.PSDiskDeps
}
MockPS is a mock implementation of the PS interface for testing purposes.
func (*MockPS) DiskUsage ¶
func (m *MockPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
DiskUsage returns the disk usage statistics.
func (*MockPS) NetConnections ¶
func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
NetConnections returns a list of network connections opened.
func (*MockPS) NetConntrack ¶
func (m *MockPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
NetConntrack returns more detailed info about the conntrack table.
func (*MockPS) NetIO ¶
func (m *MockPS) NetIO() ([]net.IOCountersStat, error)
NetIO returns network I/O statistics for every network interface installed on the system.
func (*MockPS) NetProto ¶
func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)
NetProto returns network statistics for the entire system.