Documentation
¶
Index ¶
- func ExpectedKeys(m map[string]IPSetExpectation) []string
- func LoadNetworkPolicyList(t *testing.T, path string) *networkingv1.NetworkPolicyList
- func LoadNodeList(t *testing.T, path string) *v1.NodeList
- func LoadPodList(t *testing.T, path string) *v1.PodList
- func LoadServiceList(t *testing.T, path string) *v1.ServiceList
- func MergeExpectations(maps ...map[string]IPSetExpectation) map[string]IPSetExpectation
- func NormalizeSnapshotEntry(entry string) string
- func ParseRestoreScript(script string) map[string]IPSetExpectation
- func ParseSnapshot(t *testing.T, path string) map[string]IPSetExpectation
- func ParseSnapshotWithFilter(t *testing.T, path string, includeFn func(string) bool) map[string]IPSetExpectation
- type FakeIPSetHandler
- func (h *FakeIPSetHandler) Add(_ *utils.Set) error
- func (h *FakeIPSetHandler) Create(setName string, createOptions ...string) (*utils.Set, error)
- func (h *FakeIPSetHandler) Destroy(setName string) error
- func (h *FakeIPSetHandler) DestroyAllWithin() error
- func (h *FakeIPSetHandler) Flush() error
- func (h *FakeIPSetHandler) Get(setName string) *utils.Set
- func (h *FakeIPSetHandler) Name(name string) string
- func (h *FakeIPSetHandler) RefreshSet(setName string, entriesWithOptions [][]string, setType string)
- func (h *FakeIPSetHandler) Restore() error
- func (h *FakeIPSetHandler) RestoreSets(names []string) error
- func (h *FakeIPSetHandler) Restored() string
- func (h *FakeIPSetHandler) Save() error
- func (h *FakeIPSetHandler) Sets() map[string]*utils.Set
- func (h *FakeIPSetHandler) Snapshot() map[string]IPSetExpectation
- type IPSetExpectation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectedKeys ¶
func ExpectedKeys(m map[string]IPSetExpectation) []string
ExpectedKeys returns the sorted keys of an expectation map.
func LoadNetworkPolicyList ¶
func LoadNetworkPolicyList(t *testing.T, path string) *networkingv1.NetworkPolicyList
LoadNetworkPolicyList reads a NetworkPolicyList fixture.
func LoadNodeList ¶
LoadNodeList reads a NodeList fixture.
func LoadPodList ¶
LoadPodList reads a PodList fixture.
func LoadServiceList ¶
func LoadServiceList(t *testing.T, path string) *v1.ServiceList
LoadServiceList reads a ServiceList fixture.
func MergeExpectations ¶
func MergeExpectations(maps ...map[string]IPSetExpectation) map[string]IPSetExpectation
MergeExpectations merges multiple expectation maps.
func NormalizeSnapshotEntry ¶
NormalizeSnapshotEntry normalizes entries for stable comparisons.
func ParseRestoreScript ¶
func ParseRestoreScript(script string) map[string]IPSetExpectation
ParseRestoreScript parses an ipset restore script into expectations.
func ParseSnapshot ¶
func ParseSnapshot(t *testing.T, path string) map[string]IPSetExpectation
ParseSnapshot parses an ipset save snapshot focusing on kube-router managed sets.
func ParseSnapshotWithFilter ¶
func ParseSnapshotWithFilter(t *testing.T, path string, includeFn func(string) bool) map[string]IPSetExpectation
ParseSnapshotWithFilter parses an ipset snapshot and retains set names that satisfy includeFn.
Types ¶
type FakeIPSetHandler ¶
type FakeIPSetHandler struct {
// contains filtered or unexported fields
}
FakeIPSetHandler captures ipset operations for tests.
func NewFakeIPSetHandler ¶
func NewFakeIPSetHandler(isIPv6 bool) *FakeIPSetHandler
NewFakeIPSetHandler returns a fake utils.IPSetHandler for the requested IP family.
func (*FakeIPSetHandler) Add ¶
func (h *FakeIPSetHandler) Add(_ *utils.Set) error
Add is part of the utils.IPSetHandler interface.
func (*FakeIPSetHandler) Destroy ¶
func (h *FakeIPSetHandler) Destroy(setName string) error
Destroy removes the set.
func (*FakeIPSetHandler) DestroyAllWithin ¶
func (h *FakeIPSetHandler) DestroyAllWithin() error
DestroyAllWithin resets tracked sets.
func (*FakeIPSetHandler) Flush ¶
func (h *FakeIPSetHandler) Flush() error
Flush is a no-op for the fake handler.
func (*FakeIPSetHandler) Get ¶
func (h *FakeIPSetHandler) Get(setName string) *utils.Set
Get returns metadata for a tracked set.
func (*FakeIPSetHandler) Name ¶
func (h *FakeIPSetHandler) Name(name string) string
Name normalizes a set name for the family.
func (*FakeIPSetHandler) RefreshSet ¶
func (h *FakeIPSetHandler) RefreshSet(setName string, entriesWithOptions [][]string, setType string)
RefreshSet records entries for the given set.
func (*FakeIPSetHandler) Restore ¶
func (h *FakeIPSetHandler) Restore() error
Restore builds and records the restore script.
func (*FakeIPSetHandler) RestoreSets ¶
func (h *FakeIPSetHandler) RestoreSets(names []string) error
RestoreSets builds and records the restore script for the provided sets.
func (*FakeIPSetHandler) Restored ¶
func (h *FakeIPSetHandler) Restored() string
Restored returns the last restore script that was generated.
func (*FakeIPSetHandler) Save ¶
func (h *FakeIPSetHandler) Save() error
Save is a no-op for the fake handler.
func (*FakeIPSetHandler) Sets ¶
func (h *FakeIPSetHandler) Sets() map[string]*utils.Set
Sets returns all tracked sets.
func (*FakeIPSetHandler) Snapshot ¶
func (h *FakeIPSetHandler) Snapshot() map[string]IPSetExpectation
Snapshot returns a normalized set expectation map useful for assertions.
type IPSetExpectation ¶
IPSetExpectation captures a set type and sorted entries for comparisons.