memorytest

package
v1.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package memorytest provides test doubles for the memory package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeReader

type FakeReader struct {
	SystemPct    float64
	SystemPctErr error
	RSSBySession map[string]int64
	RSSErr       error
	// contains filtered or unexported fields
}

FakeReader is a test double for memory.Reader that returns configurable values.

func (*FakeReader) GetSessionRSSCalls

func (f *FakeReader) GetSessionRSSCalls() int

GetSessionRSSCalls returns how many times SessionsRSSMB was called (not how many sessions were measured) -- useful for asserting batching behavior.

func (*FakeReader) GetSystemMemoryCalls

func (f *FakeReader) GetSystemMemoryCalls() int

func (*FakeReader) LastRSSNames added in v1.49.0

func (f *FakeReader) LastRSSNames() []string

LastRSSNames returns the session names passed to the most recent SessionsRSSMB call.

func (*FakeReader) SessionsRSSMB added in v1.49.0

func (f *FakeReader) SessionsRSSMB(_ context.Context, names []string) (map[string]int64, error)

SessionsRSSMB returns configured RSS values for each requested name. Every call is recorded (count and the requested names) so tests can assert the caller batched sessions into a single call rather than one call per session.

func (*FakeReader) SystemMemoryPct

func (f *FakeReader) SystemMemoryPct() (float64, error)

Jump to

Keyboard shortcuts

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