mocks

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockEngine

type MockEngine struct {
	mock.Mock
}

MockEngine is a mock implementation of the rules.Engine interface for testing

func (*MockEngine) CleanupServiceAccounts

func (m *MockEngine) CleanupServiceAccounts(ctx context.Context, deletingResource rules.WSAResource) (ctrl.Result, error)

func (*MockEngine) ComputeScopesForWSAs

func (m *MockEngine) ComputeScopesForWSAs(wsaList []rules.WSAResource) (map[rules.Scope]map[string]rules.WSAResource, rules.GlobalVocabulary)

ScopeComputation interface methods (embedded in Engine interface)

func (*MockEngine) DiscoverTargetNamespaces

func (m *MockEngine) DiscoverTargetNamespaces(ctx context.Context, k8sClient client.Client) ([]string, error)

func (*MockEngine) EnsureRoleBindings

func (m *MockEngine) EnsureRoleBindings(
	ctx context.Context, resources []rules.WSAResource, createdRoles map[string]rbacv1.Role,
	wsaToServiceAccounts map[string][]string, targetNamespaces []string,
) error

func (*MockEngine) EnsureRoles

func (m *MockEngine) EnsureRoles(
	ctx context.Context, resources []rules.WSAResource,
) (map[string]rbacv1.Role, error)

func (*MockEngine) EnsureServiceAccounts

func (m *MockEngine) EnsureServiceAccounts(
	ctx context.Context, serviceAccounts []*corev1.ServiceAccount, targetNamespaces []string,
) error

func (*MockEngine) GarbageCollectServiceAccounts

func (m *MockEngine) GarbageCollectServiceAccounts(
	ctx context.Context, expectedServiceAccounts *set.Set[string], targetNamespaces *set.Set[string],
) (ctrl.Result, error)

func (*MockEngine) GenerateServiceAccountMappings

func (m *MockEngine) GenerateServiceAccountMappings(scopeMap map[rules.Scope]map[string]rules.WSAResource) (map[rules.Scope]rules.ServiceAccountName, map[rules.ServiceAccountName]map[string]rules.WSAResource, map[string][]string, []*corev1.ServiceAccount)

func (*MockEngine) GetClusterRoleBindings

func (m *MockEngine) GetClusterRoleBindings(ctx context.Context) (iter.Seq[*rbacv1.ClusterRoleBinding], error)

func (*MockEngine) GetClusterRoles

func (m *MockEngine) GetClusterRoles(ctx context.Context) (iter.Seq[*rbacv1.ClusterRole], error)

func (*MockEngine) GetClusterWorkloadServiceAccounts

func (m *MockEngine) GetClusterWorkloadServiceAccounts(ctx context.Context) (iter.Seq[*v1beta1.ClusterWorkloadServiceAccount], error)

func (*MockEngine) GetRoleBindings

func (m *MockEngine) GetRoleBindings(ctx context.Context) (iter.Seq[*rbacv1.RoleBinding], error)

func (*MockEngine) GetRoles

func (m *MockEngine) GetRoles(ctx context.Context) (iter.Seq[*rbacv1.Role], error)

func (*MockEngine) GetScopeToSA

func (m *MockEngine) GetScopeToSA() map[rules.Scope]rules.ServiceAccountName

func (*MockEngine) GetServiceAccountForScope

func (m *MockEngine) GetServiceAccountForScope(scope rules.Scope) (rules.ServiceAccountName, error)

func (*MockEngine) GetServiceAccounts

func (m *MockEngine) GetServiceAccounts(ctx context.Context) (iter.Seq[*corev1.ServiceAccount], error)

func (*MockEngine) GetTargetNamespaces

func (m *MockEngine) GetTargetNamespaces() []string

func (*MockEngine) GetWorkloadServiceAccounts

func (m *MockEngine) GetWorkloadServiceAccounts(ctx context.Context) (iter.Seq[*v1beta1.WorkloadServiceAccount], error)

ResourceManagement interface methods

func (*MockEngine) Reconcile

func (m *MockEngine) Reconcile(ctx context.Context) error

func (*MockEngine) ReconcileResource

func (m *MockEngine) ReconcileResource(ctx context.Context, resource rules.WSAResource) error

Jump to

Keyboard shortcuts

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