package testing
import "k8s.io/apiserver/pkg/storage/testing"
Index ¶
- func CreateList(prefix string, helper storage.Interface, list runtime.Object) error
- func CreateObj(helper storage.Interface, name string, obj, out runtime.Object, ttl uint64) error
- func CreateObjList(prefix string, helper storage.Interface, items []runtime.Object) error
- func DeepEqualSafePodSpec() example.PodSpec
- func EncodeContinueOrDie(key string, resourceVersion int64) string
- func ExpectNoDiff(t *testing.T, msg string, expected, got interface{})
- func ResourceVersionNotOlderThan(sentinel string) func(string) error
- func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestConsistentList(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
- func RunTestCount(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestCreate(ctx context.Context, t *testing.T, store storage.Interface, validation KeyValidation)
- func RunTestCreateWithKeyExist(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestCreateWithTTL(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestDeleteTriggerWatch(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestDeleteWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestDeleteWithSuggestionOfDeletedObject(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestGet(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestGuaranteedUpdate(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer, validation KeyValidation)
- func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
- func RunTestGuaranteedUpdateWithConflict(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestGuaranteedUpdateWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestGuaranteedUpdateWithTTL(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestList(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
- func RunTestListContinuationWithFilter(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
- func RunTestListInconsistentContinuation(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction)
- func RunTestListPaginationRareObject(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
- func RunTestListWithoutPaging(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestPreconditionalDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestTransformationFailure(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
- func RunTestUnconditionalDelete(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestWatch(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestWatchContextCancel(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestWatchError(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
- func RunTestWatchFromNoneZero(ctx context.Context, t *testing.T, store storage.Interface)
- func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction)
- func RunTestWatchInitializationSignal(ctx context.Context, t *testing.T, store storage.Interface)
- func TestCheckEventType(t *testing.T, expectEventType watch.EventType, w watch.Interface)
- func TestCheckResult(t *testing.T, expectEventType watch.EventType, w watch.Interface, expectObj *example.Pod)
- func TestCheckResultFunc(t *testing.T, expectEventType watch.EventType, w watch.Interface, check func(object runtime.Object) error)
- func TestCheckStop(t *testing.T, w watch.Interface)
- func TestPropagateStore(ctx context.Context, t *testing.T, store storage.Interface, obj *example.Pod) (string, *example.Pod)
- func TestPropagateStoreWithKey(ctx context.Context, t *testing.T, store storage.Interface, key string, obj *example.Pod) *example.Pod
- type CallsValidation
- type Compaction
- type InterfaceWithPrefixTransformer
- type KeyValidation
- type PrefixTransformer
- func NewPrefixTransformer(prefix []byte, stale bool) *PrefixTransformer
- func (p *PrefixTransformer) GetReadsAndReset() uint64
- func (p *PrefixTransformer) TransformFromStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, bool, error)
- func (p *PrefixTransformer) TransformToStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, error)
- type PrefixTransformerModifier
Functions ¶
func CreateList ¶
CreateList will properly create a list using the storage interface.
func CreateObj ¶
CreateObj will create a single object using the storage interface.
func CreateObjList ¶
CreateObjList will create a list from the array of objects.
func DeepEqualSafePodSpec ¶
DeepEqualSafePodSpec returns an example.PodSpec safe for deep-equal operations.
func EncodeContinueOrDie ¶
func ExpectNoDiff ¶
func ResourceVersionNotOlderThan ¶
ResourceVersionNotOlderThan returns a function to validate resource versions. Resource versions referring to points in logical time before the sentinel generate an error. All logical times as new as the sentinel or newer generate no error.
func RunTestConditionalDelete ¶
func RunTestConsistentList ¶
func RunTestConsistentList(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
func RunTestCount ¶
func RunTestCreate ¶
func RunTestCreate(ctx context.Context, t *testing.T, store storage.Interface, validation KeyValidation)
func RunTestCreateWithKeyExist ¶
func RunTestCreateWithTTL ¶
func RunTestDeleteTriggerWatch ¶
func RunTestDeleteWithSuggestion ¶
func RunTestDeleteWithSuggestionAndConflict ¶
func RunTestDeleteWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestDeleteWithSuggestionOfDeletedObject ¶
func RunTestDeleteWithSuggestionOfDeletedObject(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestGet ¶
func RunTestGetListNonRecursive ¶
func RunTestGuaranteedUpdate ¶
func RunTestGuaranteedUpdate(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer, validation KeyValidation)
func RunTestGuaranteedUpdateChecksStoredData ¶
func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
func RunTestGuaranteedUpdateWithConflict ¶
func RunTestGuaranteedUpdateWithConflict(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestGuaranteedUpdateWithSuggestionAndConflict ¶
func RunTestGuaranteedUpdateWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestGuaranteedUpdateWithTTL ¶
func RunTestList ¶
func RunTestListContinuation ¶
func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
func RunTestListContinuationWithFilter ¶
func RunTestListContinuationWithFilter(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
func RunTestListInconsistentContinuation ¶
func RunTestListInconsistentContinuation(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction)
func RunTestListPaginationRareObject ¶
func RunTestListPaginationRareObject(ctx context.Context, t *testing.T, store storage.Interface, validation CallsValidation)
func RunTestListWithoutPaging ¶
func RunTestPreconditionalDeleteWithSuggestion ¶
func RunTestPreconditionalDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestTransformationFailure ¶
func RunTestTransformationFailure(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
func RunTestUnconditionalDelete ¶
func RunTestValidateDeletionWithSuggestion ¶
func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)
func RunTestWatch ¶
func RunTestWatchContextCancel ¶
func RunTestWatchError ¶
func RunTestWatchError(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)
func RunTestWatchFromNoneZero ¶
func RunTestWatchFromZero ¶
func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction)
RunTestWatchFromZero tests that - watch from 0 should sync up and grab the object added before - watch from 0 is able to return events for objects whose previous version has been compacted
func RunTestWatchInitializationSignal ¶
func TestCheckEventType ¶
func TestCheckResult ¶
func TestCheckResult(t *testing.T, expectEventType watch.EventType, w watch.Interface, expectObj *example.Pod)
func TestCheckResultFunc ¶
func TestCheckResultFunc(t *testing.T, expectEventType watch.EventType, w watch.Interface, check func(object runtime.Object) error)
func TestCheckStop ¶
func TestPropagateStore ¶
func TestPropagateStore(ctx context.Context, t *testing.T, store storage.Interface, obj *example.Pod) (string, *example.Pod)
TestPropagateStore helps propagates store with objects, automates key generation, and returns keys and stored objects.
func TestPropagateStoreWithKey ¶
func TestPropagateStoreWithKey(ctx context.Context, t *testing.T, store storage.Interface, key string, obj *example.Pod) *example.Pod
TestPropagateStoreWithKey helps propagate store with objects, the given object will be stored at the specified key.
Types ¶
type CallsValidation ¶
type Compaction ¶
type InterfaceWithPrefixTransformer ¶
type InterfaceWithPrefixTransformer interface { storage.Interface UpdatePrefixTransformer(PrefixTransformerModifier) func() }
type KeyValidation ¶
type PrefixTransformer ¶
type PrefixTransformer struct {
// contains filtered or unexported fields
}
PrefixTransformer adds and verifies that all data has the correct prefix on its way in and out.
func NewPrefixTransformer ¶
func NewPrefixTransformer(prefix []byte, stale bool) *PrefixTransformer
func (*PrefixTransformer) GetReadsAndReset ¶
func (p *PrefixTransformer) GetReadsAndReset() uint64
func (*PrefixTransformer) TransformFromStorage ¶
func (p *PrefixTransformer) TransformFromStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, bool, error)
func (*PrefixTransformer) TransformToStorage ¶
func (p *PrefixTransformer) TransformToStorage(ctx context.Context, data []byte, dataCtx value.Context) ([]byte, error)
type PrefixTransformerModifier ¶
type PrefixTransformerModifier func(*PrefixTransformer) value.Transformer
Source Files ¶
store_tests.go utils.go watcher_tests.go
- Version
- v0.26.0-alpha.3
- Published
- Nov 2, 2022
- Platform
- js/wasm
- Imports
- 30 packages
- Last checked
- 1 minute ago –
Tools for package owners.