apiserverk8s.io/apiserver/pkg/storage/testing Index | Files

package testing

import "k8s.io/apiserver/pkg/storage/testing"

Index

Functions

func CreateList

func CreateList(prefix string, helper storage.Interface, list runtime.Object) error

CreateList will properly create a list using the storage interface.

func CreateObjList

func CreateObjList(prefix string, helper storage.Interface, items []runtime.Object) error

CreateObjList will create a list from the array of objects.

func DeepEqualSafePodSpec

func DeepEqualSafePodSpec() example.PodSpec

DeepEqualSafePodSpec returns an example.PodSpec safe for deep-equal operations.

func ExpectContains

func ExpectContains(t *testing.T, msg string, expectedList []interface{}, got interface{})

func ExpectNoDiff

func ExpectNoDiff(t *testing.T, msg string, expected, got interface{})

func RunOptionalTestProgressNotify

func RunOptionalTestProgressNotify(ctx context.Context, t *testing.T, store storage.Interface)

RunOptionalTestProgressNotify tests ProgressNotify feature of ListOptions. Given this feature is currently not explicitly used by higher layers of Kubernetes (it rather is used by wrappers of storage.Interface to implement its functionalities) this test is currently considered optional.

func RunSendInitialEventsBackwardCompatibility

func RunSendInitialEventsBackwardCompatibility(ctx context.Context, t *testing.T, store storage.Interface)

RunSendInitialEventsBackwardCompatibility test backward compatibility when SendInitialEvents option is set against various implementations. Backward compatibility is defined as RV = "" || RV = "O" and AllowWatchBookmark is set to false. In that case we expect a watch request to be established.

func RunTestClusterScopedWatch

func RunTestClusterScopedWatch(ctx context.Context, t *testing.T, store storage.Interface)

It tests watches of cluster-scoped resources.

func RunTestConditionalDelete

func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestConsistentList

func RunTestConsistentList(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)

func RunTestCount

func RunTestCount(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestCreate

func RunTestCreate(ctx context.Context, t *testing.T, store storage.Interface, validation KeyValidation)

func RunTestCreateWithKeyExist

func RunTestCreateWithKeyExist(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestCreateWithTTL

func RunTestCreateWithTTL(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestDelayedWatchDelivery

func RunTestDelayedWatchDelivery(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestDeleteTriggerWatch

func RunTestDeleteTriggerWatch(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestDeleteWithSuggestion

func RunTestDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)

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 RunTestGet(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestGetListNonRecursive

func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage.Interface)

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 RunTestGuaranteedUpdateWithTTL(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestList

func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction, ignoreWatchCacheTests bool)

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 RunTestListWithoutPaging(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestNamespaceScopedWatch

func RunTestNamespaceScopedWatch(ctx context.Context, t *testing.T, store storage.Interface)

It tests watch of namespace-scoped resources.

func RunTestOptionalWatchBookmarksWithCorrectResourceVersion

func RunTestOptionalWatchBookmarksWithCorrectResourceVersion(ctx context.Context, t *testing.T, store storage.Interface)

RunOptionalTestWatchBookmarksWithCorrectResourceVersion tests whether bookmark events are sent with correct resource versions. This feature is currently implemented in watch cache layer, so this is optional.

TODO(#109831): ProgressNotify feature is effectively implementing the same

functionality, so we should refactor this functionality to share the same input.

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 RunTestUnconditionalDelete(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestValidateDeletionWithSuggestion

func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatch

func RunTestWatch(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatchContextCancel

func RunTestWatchContextCancel(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatchDeleteEventObjectHaveLatestRV

func RunTestWatchDeleteEventObjectHaveLatestRV(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatchDispatchBookmarkEvents

func RunTestWatchDispatchBookmarkEvents(ctx context.Context, t *testing.T, store storage.Interface)

RunOptionalTestWatchDispatchBookmarkEvents tests whether bookmark events are sent. This feature is currently implemented in watch cache layer, so this is optional.

TODO(#109831): ProgressNotify feature is effectively implementing the same

functionality, so we should refactor this functionality to share the same input.

func RunTestWatchError

func RunTestWatchError(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer)

func RunTestWatchFromNonZero

func RunTestWatchFromNonZero(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatchFromZero

func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction)

RunTestWatchFromZero tests that

func RunTestWatchInitializationSignal

func RunTestWatchInitializationSignal(ctx context.Context, t *testing.T, store storage.Interface)

func RunTestWatcherTimeout

func RunTestWatcherTimeout(ctx context.Context, t *testing.T, store storage.Interface)

Types

type CallsValidation

type CallsValidation func(t *testing.T, pageSize, estimatedProcessedObjects uint64)

type Compaction

type Compaction func(ctx context.Context, t *testing.T, resourceVersion string)

type InterfaceWithPrefixTransformer

type InterfaceWithPrefixTransformer interface {
	storage.Interface

	UpdatePrefixTransformer(PrefixTransformerModifier) func()
}

type KeyValidation

type KeyValidation func(ctx context.Context, t *testing.T, key string)

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

type StorageInjectingListErrors

type StorageInjectingListErrors struct {
	storage.Interface

	Errors int
	// contains filtered or unexported fields
}

StorageInjectingListErrors injects a dummy error for first N GetList calls.

func (*StorageInjectingListErrors) ErrorsConsumed

func (s *StorageInjectingListErrors) ErrorsConsumed() (bool, error)

func (*StorageInjectingListErrors) GetList

Source Files

store_tests.go utils.go watcher_tests.go

Version
v0.28.2
Published
Sep 13, 2023
Platform
js/wasm
Imports
35 packages
Last checked
1 minute ago

Tools for package owners.