package testing
import "k8s.io/apiserver/pkg/storage/cacher/testing"
Index ¶
- func NewMockWatch() watch.Interface
- type MockCacher
- type MockStorage
- func (d *MockStorage) CompactRevision() int64
- func (d *MockStorage) Create(_ context.Context, _ string, _, _ runtime.Object, _ uint64) error
- func (d *MockStorage) Delete(_ context.Context, _ string, _ runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object, _ storage.DeleteOptions) error
- func (d *MockStorage) EnableResourceSizeEstimation(storage.KeysFunc) error
- func (d *MockStorage) Get(_ context.Context, _ string, _ storage.GetOptions, _ runtime.Object) error
- func (d *MockStorage) GetCurrentResourceVersion(ctx context.Context) (uint64, error)
- func (d *MockStorage) GetList(ctx context.Context, resPrefix string, opts storage.ListOptions, listObj runtime.Object) error
- func (d *MockStorage) GetRequestWatchProgressCounter() int
- func (d *MockStorage) GuaranteedUpdate(_ context.Context, _ string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error
- func (d *MockStorage) InjectGetListError(err error)
- func (d *MockStorage) IsWatchListSemanticsUnSupported() bool
- func (d *MockStorage) ReadinessCheck() error
- func (d *MockStorage) RequestWatchProgress(ctx context.Context) error
- func (d *MockStorage) Stats(_ context.Context) (storage.Stats, error)
- func (d *MockStorage) Versioner() storage.Versioner
- func (d *MockStorage) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
- type MockWatch
Functions ¶
func NewMockWatch ¶
Types ¶
type MockCacher ¶
type MockCacher struct {
MockStorage
IsReady bool
Consistent bool
}
func (*MockCacher) MarkConsistent ¶
func (d *MockCacher) MarkConsistent(consistent bool)
func (*MockCacher) Ready ¶
func (d *MockCacher) Ready() bool
type MockStorage ¶
type MockStorage struct {
sync.RWMutex
GetListErr error
WatchErr error
GetListFn func(_ context.Context, _ string, _ storage.ListOptions, listObj runtime.Object) error
GetRVFn func(_ context.Context) (uint64, error)
WatchFn func(_ context.Context, _ string, _ storage.ListOptions) (watch.Interface, error)
// use GetRequestWatchProgressCounter when reading
// the value of the counter
RequestWatchProgressCounter int
}
func (*MockStorage) CompactRevision ¶
func (d *MockStorage) CompactRevision() int64
func (*MockStorage) Create ¶
func (*MockStorage) Delete ¶
func (d *MockStorage) Delete(_ context.Context, _ string, _ runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object, _ storage.DeleteOptions) error
func (*MockStorage) EnableResourceSizeEstimation ¶
func (d *MockStorage) EnableResourceSizeEstimation(storage.KeysFunc) error
func (*MockStorage) Get ¶
func (d *MockStorage) Get(_ context.Context, _ string, _ storage.GetOptions, _ runtime.Object) error
func (*MockStorage) GetCurrentResourceVersion ¶
func (d *MockStorage) GetCurrentResourceVersion(ctx context.Context) (uint64, error)
func (*MockStorage) GetList ¶
func (d *MockStorage) GetList(ctx context.Context, resPrefix string, opts storage.ListOptions, listObj runtime.Object) error
func (*MockStorage) GetRequestWatchProgressCounter ¶
func (d *MockStorage) GetRequestWatchProgressCounter() int
func (*MockStorage) GuaranteedUpdate ¶
func (d *MockStorage) GuaranteedUpdate(_ context.Context, _ string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error
func (*MockStorage) InjectGetListError ¶
func (d *MockStorage) InjectGetListError(err error)
func (*MockStorage) IsWatchListSemanticsUnSupported ¶
func (d *MockStorage) IsWatchListSemanticsUnSupported() bool
func (*MockStorage) ReadinessCheck ¶
func (d *MockStorage) ReadinessCheck() error
func (*MockStorage) RequestWatchProgress ¶
func (d *MockStorage) RequestWatchProgress(ctx context.Context) error
func (*MockStorage) Stats ¶
func (*MockStorage) Versioner ¶
func (d *MockStorage) Versioner() storage.Versioner
func (*MockStorage) Watch ¶
func (d *MockStorage) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error)
type MockWatch ¶
type MockWatch struct {
// contains filtered or unexported fields
}
func (*MockWatch) ResultChan ¶
func (*MockWatch) Stop ¶
func (w *MockWatch) Stop()
Source Files ¶
mock.go
- Version
- v0.36.0 (latest)
- Published
- Apr 22, 2026
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 4 days ago –
Tools for package owners.