psutiltest

package
v1.40.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDiskUsage

type MockDiskUsage struct {
	*mock.Mock
}

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) CPUTimes

func (m *MockPS) CPUTimes(_, _ bool) ([]cpu.TimesStat, error)

CPUTimes returns the CPU times statistics.

func (*MockPS) DiskIO

func (m *MockPS) DiskIO(_ []string) (map[string]disk.IOCountersStat, error)

DiskIO returns the disk I/O statistics.

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.

func (*MockPS) SwapStat

func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)

SwapStat returns the swap memory statistics.

func (*MockPS) VMStat

func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)

VMStat returns the virtual memory statistics.

type MockPSDisk

type MockPSDisk struct {
	*psutil.SystemPS
	*mock.Mock
}

MockPSDisk is a mock implementation of the PSDiskDeps interface for testing purposes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL