mocks

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FirewallManagerMock

type FirewallManagerMock struct {
	// AddRulesFunc mocks the AddRules method.
	AddRulesFunc func(ctx context.Context, rules []config.EgressRule) error

	// BypassFunc mocks the Bypass method.
	BypassFunc func(ctx context.Context, containerID string, timeout time.Duration) error

	// CoreDNSIPFunc mocks the CoreDNSIP method.
	CoreDNSIPFunc func() string

	// DisableFunc mocks the Disable method.
	DisableFunc func(ctx context.Context, containerID string) error

	// EnableFunc mocks the Enable method.
	EnableFunc func(ctx context.Context, containerID string) error

	// EnsureRunningFunc mocks the EnsureRunning method.
	EnsureRunningFunc func(ctx context.Context) error

	// EnvoyIPFunc mocks the EnvoyIP method.
	EnvoyIPFunc func() string

	// IsRunningFunc mocks the IsRunning method.
	IsRunningFunc func(ctx context.Context) bool

	// ListFunc mocks the List method.
	ListFunc func(ctx context.Context) ([]config.EgressRule, error)

	// NetCIDRFunc mocks the NetCIDR method.
	NetCIDRFunc func() string

	// ReloadFunc mocks the Reload method.
	ReloadFunc func(ctx context.Context) error

	// RemoveRulesFunc mocks the RemoveRules method.
	RemoveRulesFunc func(ctx context.Context, rules []config.EgressRule) error

	// StatusFunc mocks the Status method.
	StatusFunc func(ctx context.Context) (*firewall.FirewallStatus, error)

	// StopFunc mocks the Stop method.
	StopFunc func(ctx context.Context) error

	// WaitForHealthyFunc mocks the WaitForHealthy method.
	WaitForHealthyFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

FirewallManagerMock is a mock implementation of firewall.FirewallManager.

func TestSomethingThatUsesFirewallManager(t *testing.T) {

	// make and configure a mocked firewall.FirewallManager
	mockedFirewallManager := &FirewallManagerMock{
		AddRulesFunc: func(ctx context.Context, rules []config.EgressRule) error {
			panic("mock out the AddRules method")
		},
		BypassFunc: func(ctx context.Context, containerID string, timeout time.Duration) error {
			panic("mock out the Bypass method")
		},
		CoreDNSIPFunc: func() string {
			panic("mock out the CoreDNSIP method")
		},
		DisableFunc: func(ctx context.Context, containerID string) error {
			panic("mock out the Disable method")
		},
		EnableFunc: func(ctx context.Context, containerID string) error {
			panic("mock out the Enable method")
		},
		EnsureRunningFunc: func(ctx context.Context) error {
			panic("mock out the EnsureRunning method")
		},
		EnvoyIPFunc: func() string {
			panic("mock out the EnvoyIP method")
		},
		IsRunningFunc: func(ctx context.Context) bool {
			panic("mock out the IsRunning method")
		},
		ListFunc: func(ctx context.Context) ([]config.EgressRule, error) {
			panic("mock out the List method")
		},
		NetCIDRFunc: func() string {
			panic("mock out the NetCIDR method")
		},
		ReloadFunc: func(ctx context.Context) error {
			panic("mock out the Reload method")
		},
		RemoveRulesFunc: func(ctx context.Context, rules []config.EgressRule) error {
			panic("mock out the RemoveRules method")
		},
		StatusFunc: func(ctx context.Context) (*firewall.FirewallStatus, error) {
			panic("mock out the Status method")
		},
		StopFunc: func(ctx context.Context) error {
			panic("mock out the Stop method")
		},
		WaitForHealthyFunc: func(ctx context.Context) error {
			panic("mock out the WaitForHealthy method")
		},
	}

	// use mockedFirewallManager in code that requires firewall.FirewallManager
	// and then make assertions.

}

func (*FirewallManagerMock) AddRules

func (mock *FirewallManagerMock) AddRules(ctx context.Context, rules []config.EgressRule) error

AddRules calls AddRulesFunc.

func (*FirewallManagerMock) AddRulesCalls

func (mock *FirewallManagerMock) AddRulesCalls() []struct {
	Ctx   context.Context
	Rules []config.EgressRule
}

AddRulesCalls gets all the calls that were made to AddRules. Check the length with:

len(mockedFirewallManager.AddRulesCalls())

func (*FirewallManagerMock) Bypass

func (mock *FirewallManagerMock) Bypass(ctx context.Context, containerID string, timeout time.Duration) error

Bypass calls BypassFunc.

func (*FirewallManagerMock) BypassCalls

func (mock *FirewallManagerMock) BypassCalls() []struct {
	Ctx         context.Context
	ContainerID string
	Timeout     time.Duration
}

BypassCalls gets all the calls that were made to Bypass. Check the length with:

len(mockedFirewallManager.BypassCalls())

func (*FirewallManagerMock) CoreDNSIP

func (mock *FirewallManagerMock) CoreDNSIP() string

CoreDNSIP calls CoreDNSIPFunc.

func (*FirewallManagerMock) CoreDNSIPCalls

func (mock *FirewallManagerMock) CoreDNSIPCalls() []struct {
}

CoreDNSIPCalls gets all the calls that were made to CoreDNSIP. Check the length with:

len(mockedFirewallManager.CoreDNSIPCalls())

func (*FirewallManagerMock) Disable

func (mock *FirewallManagerMock) Disable(ctx context.Context, containerID string) error

Disable calls DisableFunc.

func (*FirewallManagerMock) DisableCalls

func (mock *FirewallManagerMock) DisableCalls() []struct {
	Ctx         context.Context
	ContainerID string
}

DisableCalls gets all the calls that were made to Disable. Check the length with:

len(mockedFirewallManager.DisableCalls())

func (*FirewallManagerMock) Enable

func (mock *FirewallManagerMock) Enable(ctx context.Context, containerID string) error

Enable calls EnableFunc.

func (*FirewallManagerMock) EnableCalls

func (mock *FirewallManagerMock) EnableCalls() []struct {
	Ctx         context.Context
	ContainerID string
}

EnableCalls gets all the calls that were made to Enable. Check the length with:

len(mockedFirewallManager.EnableCalls())

func (*FirewallManagerMock) EnsureRunning

func (mock *FirewallManagerMock) EnsureRunning(ctx context.Context) error

EnsureRunning calls EnsureRunningFunc.

func (*FirewallManagerMock) EnsureRunningCalls

func (mock *FirewallManagerMock) EnsureRunningCalls() []struct {
	Ctx context.Context
}

EnsureRunningCalls gets all the calls that were made to EnsureRunning. Check the length with:

len(mockedFirewallManager.EnsureRunningCalls())

func (*FirewallManagerMock) EnvoyIP

func (mock *FirewallManagerMock) EnvoyIP() string

EnvoyIP calls EnvoyIPFunc.

func (*FirewallManagerMock) EnvoyIPCalls

func (mock *FirewallManagerMock) EnvoyIPCalls() []struct {
}

EnvoyIPCalls gets all the calls that were made to EnvoyIP. Check the length with:

len(mockedFirewallManager.EnvoyIPCalls())

func (*FirewallManagerMock) IsRunning

func (mock *FirewallManagerMock) IsRunning(ctx context.Context) bool

IsRunning calls IsRunningFunc.

func (*FirewallManagerMock) IsRunningCalls

func (mock *FirewallManagerMock) IsRunningCalls() []struct {
	Ctx context.Context
}

IsRunningCalls gets all the calls that were made to IsRunning. Check the length with:

len(mockedFirewallManager.IsRunningCalls())

func (*FirewallManagerMock) List

List calls ListFunc.

func (*FirewallManagerMock) ListCalls

func (mock *FirewallManagerMock) ListCalls() []struct {
	Ctx context.Context
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedFirewallManager.ListCalls())

func (*FirewallManagerMock) NetCIDR

func (mock *FirewallManagerMock) NetCIDR() string

NetCIDR calls NetCIDRFunc.

func (*FirewallManagerMock) NetCIDRCalls

func (mock *FirewallManagerMock) NetCIDRCalls() []struct {
}

NetCIDRCalls gets all the calls that were made to NetCIDR. Check the length with:

len(mockedFirewallManager.NetCIDRCalls())

func (*FirewallManagerMock) Reload

func (mock *FirewallManagerMock) Reload(ctx context.Context) error

Reload calls ReloadFunc.

func (*FirewallManagerMock) ReloadCalls

func (mock *FirewallManagerMock) ReloadCalls() []struct {
	Ctx context.Context
}

ReloadCalls gets all the calls that were made to Reload. Check the length with:

len(mockedFirewallManager.ReloadCalls())

func (*FirewallManagerMock) RemoveRules

func (mock *FirewallManagerMock) RemoveRules(ctx context.Context, rules []config.EgressRule) error

RemoveRules calls RemoveRulesFunc.

func (*FirewallManagerMock) RemoveRulesCalls

func (mock *FirewallManagerMock) RemoveRulesCalls() []struct {
	Ctx   context.Context
	Rules []config.EgressRule
}

RemoveRulesCalls gets all the calls that were made to RemoveRules. Check the length with:

len(mockedFirewallManager.RemoveRulesCalls())

func (*FirewallManagerMock) Status

Status calls StatusFunc.

func (*FirewallManagerMock) StatusCalls

func (mock *FirewallManagerMock) StatusCalls() []struct {
	Ctx context.Context
}

StatusCalls gets all the calls that were made to Status. Check the length with:

len(mockedFirewallManager.StatusCalls())

func (*FirewallManagerMock) Stop

func (mock *FirewallManagerMock) Stop(ctx context.Context) error

Stop calls StopFunc.

func (*FirewallManagerMock) StopCalls

func (mock *FirewallManagerMock) StopCalls() []struct {
	Ctx context.Context
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedFirewallManager.StopCalls())

func (*FirewallManagerMock) WaitForHealthy

func (mock *FirewallManagerMock) WaitForHealthy(ctx context.Context) error

WaitForHealthy calls WaitForHealthyFunc.

func (*FirewallManagerMock) WaitForHealthyCalls

func (mock *FirewallManagerMock) WaitForHealthyCalls() []struct {
	Ctx context.Context
}

WaitForHealthyCalls gets all the calls that were made to WaitForHealthy. Check the length with:

len(mockedFirewallManager.WaitForHealthyCalls())

Jump to

Keyboard shortcuts

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