...

Package fake

import "sigs.k8s.io/controller-runtime/pkg/leaderelection/fake"
Overview
Index

Overview ▾

Package fake mocks a resource lock for testing purposes. Always returns leadership.

func NewResourceLock

func NewResourceLock(config *rest.Config, recorderProvider recorder.Provider, options leaderelection.Options) (resourcelock.Interface, error)

NewResourceLock creates a new ResourceLock for use in testing leader election.

type ResourceLock

ResourceLock implements the ResourceLockInterface. By default returns that the current identity holds the lock.

type ResourceLock struct {
    // contains filtered or unexported fields
}

func (*ResourceLock) Create

func (f *ResourceLock) Create(ctx context.Context, ler resourcelock.LeaderElectionRecord) error

Create implements the ResourceLockInterface.

func (*ResourceLock) Describe

func (f *ResourceLock) Describe() string

Describe implements the ResourceLockInterface.

func (*ResourceLock) Get

func (f *ResourceLock) Get(ctx context.Context) (*resourcelock.LeaderElectionRecord, []byte, error)

Get implements the ResourceLockInterface.

func (*ResourceLock) Identity

func (f *ResourceLock) Identity() string

Identity implements the ResourceLockInterface.

func (*ResourceLock) RecordEvent

func (f *ResourceLock) RecordEvent(s string)

RecordEvent implements the ResourceLockInterface.

func (*ResourceLock) Update

func (f *ResourceLock) Update(ctx context.Context, ler resourcelock.LeaderElectionRecord) error

Update implements the ResourceLockInterface.