testutils

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookPathAll

func LookPathAll(p string) (string, error)

func LookPathNoLegacy

func LookPathNoLegacy(p string) (string, error)

func PrependLine

func PrependLine(src []string, line string) []string

Types

type MockDataplane

type MockDataplane struct {
	Prologue                       string
	Table                          string
	Chains                         map[string][]string
	FlushedChains                  set.Set[string]
	ChainMods                      set.Set[chainMod]
	DeletedChains                  set.Set[string]
	Cmds                           []cmdshim.CmdIface
	CmdNames                       []string
	FailNextRestore                bool
	FailAllRestores                bool
	OnPreRestore                   func()
	FailNextSaveRead               bool
	FailNextSaveStdoutPipe         bool
	FailNextKill                   bool
	FailAllSaves                   bool
	FailNextPipeClose              bool
	FailNextStart                  bool
	FailNextGetKernelVersionReader bool
	PipeBuffers                    []*closableBuffer
	CumulativeSleep                time.Duration
	Time                           time.Time
	FailNextVersion                bool
	Version                        string
	KernelVersion                  string
	NftablesMode                   bool
}

func NewMockDataplane

func NewMockDataplane(table string, chains map[string][]string, dataplaneMode string) *MockDataplane

func (*MockDataplane) AdvanceTimeBy

func (d *MockDataplane) AdvanceTimeBy(amount time.Duration)

func (*MockDataplane) ChainFlushed

func (d *MockDataplane) ChainFlushed(chainName string) bool

func (*MockDataplane) GetKernelVersionReader

func (d *MockDataplane) GetKernelVersionReader() (io.Reader, error)

func (*MockDataplane) NewCmd

func (d *MockDataplane) NewCmd(name string, arg ...string) cmdshim.CmdIface

func (*MockDataplane) Now

func (d *MockDataplane) Now() time.Time

func (*MockDataplane) ResetCmds

func (d *MockDataplane) ResetCmds()

func (*MockDataplane) RuleTouched

func (d *MockDataplane) RuleTouched(chainName string, ruleNum int) bool

func (*MockDataplane) Sleep

func (d *MockDataplane) Sleep(duration time.Duration)

Jump to

Keyboard shortcuts

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