mocks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 11 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) ApplyBatchPlan added in v1.0.0

func (m *MockEngine) ApplyBatchPlan(ctx context.Context, plan interface{}) error

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[types.NamespacedName]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[types.NamespacedName]rbacv1.Role,
	wsaToServiceAccounts map[types.NamespacedName][]string, targetNamespaces []string,
) error

func (*MockEngine) EnsureRoles

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

func (*MockEngine) EnsureServiceAccounts

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

func (*MockEngine) GarbageCollectClusterRoleBindings added in v1.0.0

func (m *MockEngine) GarbageCollectClusterRoleBindings(ctx context.Context, resources []rules.WSAResource) error

func (*MockEngine) GarbageCollectRoleBindings added in v1.0.0

func (m *MockEngine) GarbageCollectRoleBindings(ctx context.Context, resources []rules.WSAResource, targetNamespaces []string) error

func (*MockEngine) GarbageCollectRoles added in v1.0.0

func (m *MockEngine) GarbageCollectRoles(ctx context.Context, resources []rules.WSAResource) error

func (*MockEngine) GarbageCollectServiceAccounts

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

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

Jump to

Keyboard shortcuts

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