Documentation ¶
Index ¶
- func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace
- func DefaultEtcdOptions() *options.EtcdOptions
- func DefaultOpenAPIConfig() *openapicommon.Config
- func DeleteTestingNamespace(ns *v1.Namespace, apiserver *httptest.Server, t *testing.T)
- func EtcdMain(tests func() int)
- func Filter(nodeList *v1.NodeList, fn func(node v1.Node) bool)
- func GetEtcdURL() string
- func GetReadySchedulableNodes(c clientset.Interface) (nodes *v1.NodeList, err error)
- func IsConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
- func IsConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
- func IsNodeReady(node *v1.Node) bool
- func IsNodeSchedulable(node *v1.Node) bool
- func NewIntegrationTestMasterConfig() *controlplane.Config
- func NewIntegrationTestMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
- func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, ...) testutils.TestNodePreparer
- func NewIntegrationTestNodePreparerWithNodeSpec(client clientset.Interface, countToStrategy []testutils.CountToStrategy, ...) testutils.TestNodePreparer
- func NewMasterConfig() *controlplane.Config
- func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
- func NewSingleContentTypeSerializer(scheme *runtime.Scheme, info runtime.SerializerInfo) runtime.StorageSerializer
- func RunCustomEtcd(dataDir string, customFlags []string) (url string, stopFn func(), err error)
- func SharedEtcd() *storagebackend.Config
- func StartTestServer(t *testing.T, stopCh <-chan struct{}, setup TestServerSetup) (client.Interface, *rest.Config)
- type CloseFunc
- type Config
- type IntegrationTestNodePreparer
- type MasterConfigOptions
- type MasterHolder
- type MasterReceiver
- type TestServerSetup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestingNamespace ¶ added in v1.4.0
func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace
CreateTestingNamespace creates a namespace for testing.
func DefaultEtcdOptions ¶ added in v1.15.0
func DefaultEtcdOptions() *options.EtcdOptions
DefaultEtcdOptions are the default EtcdOptions for use with integration tests.
func DefaultOpenAPIConfig ¶ added in v1.14.0
func DefaultOpenAPIConfig() *openapicommon.Config
DefaultOpenAPIConfig returns an openapicommon.Config initialized to default values.
func DeleteTestingNamespace ¶ added in v1.4.0
DeleteTestingNamespace is currently a no-op function.
func EtcdMain ¶ added in v1.8.0
func EtcdMain(tests func() int)
EtcdMain starts an etcd instance before running tests.
func Filter ¶ added in v1.19.0
Filter filters nodes in NodeList in place, removing nodes that do not satisfy the given condition
func GetEtcdURL ¶ added in v1.8.0
func GetEtcdURL() string
GetEtcdURL returns the URL of the etcd instance started by EtcdMain.
func GetReadySchedulableNodes ¶ added in v1.19.0
GetReadySchedulableNodes addresses the common use case of getting nodes you can do work on. 1) Needs to be schedulable. 2) Needs to be ready. If EITHER 1 or 2 is not true, most tests will want to ignore the node entirely. If there are no nodes that are both ready and schedulable, this will return an error.
func IsConditionSetAsExpected ¶ added in v1.19.0
func IsConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
IsConditionSetAsExpected returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue with detailed logging.
func IsConditionSetAsExpectedSilent ¶ added in v1.19.0
func IsConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
IsConditionSetAsExpectedSilent returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue.
func IsNodeReady ¶ added in v1.19.0
IsNodeReady returns true if: 1) it's Ready condition is set to true 2) doesn't have NetworkUnavailable condition set to true
func IsNodeSchedulable ¶ added in v1.19.0
IsNodeSchedulable returns true if: 1) doesn't have "unschedulable" field set 2) it also returns true from IsNodeReady
func NewIntegrationTestMasterConfig ¶ added in v1.2.0
func NewIntegrationTestMasterConfig() *controlplane.Config
NewIntegrationTestMasterConfig returns the master config appropriate for most integration tests.
func NewIntegrationTestMasterConfigWithOptions ¶ added in v1.15.0
func NewIntegrationTestMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
NewIntegrationTestMasterConfigWithOptions returns the master config appropriate for most integration tests configured with the provided options.
func NewIntegrationTestNodePreparer ¶ added in v1.5.0
func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeNamePrefix string) testutils.TestNodePreparer
NewIntegrationTestNodePreparer creates an IntegrationTestNodePreparer configured with defaults.
func NewIntegrationTestNodePreparerWithNodeSpec ¶ added in v1.18.0
func NewIntegrationTestNodePreparerWithNodeSpec(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeSpec *v1.Node) testutils.TestNodePreparer
NewIntegrationTestNodePreparerWithNodeSpec creates an IntegrationTestNodePreparer configured with nodespec.
func NewMasterConfig ¶ added in v1.2.0
func NewMasterConfig() *controlplane.Config
NewMasterConfig returns a basic master config.
func NewMasterConfigWithOptions ¶ added in v1.15.0
func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
NewMasterConfigWithOptions returns a basic master config configured with the provided options.
func NewSingleContentTypeSerializer ¶ added in v1.3.0
func NewSingleContentTypeSerializer(scheme *runtime.Scheme, info runtime.SerializerInfo) runtime.StorageSerializer
NewSingleContentTypeSerializer wraps a serializer in a NegotiatedSerializer that handles one content type
func RunCustomEtcd ¶ added in v1.20.0
RunCustomEtcd starts a custom etcd instance for test purposes.
func SharedEtcd ¶ added in v1.9.0
func SharedEtcd() *storagebackend.Config
SharedEtcd creates a storage config for a shared etcd instance, with a unique prefix.
func StartTestServer ¶ added in v1.11.8
func StartTestServer(t *testing.T, stopCh <-chan struct{}, setup TestServerSetup) (client.Interface, *rest.Config)
StartTestServer runs a kube-apiserver, optionally calling out to the setup.ModifyServerRunOptions and setup.ModifyServerConfig functions
Types ¶
type CloseFunc ¶ added in v1.7.0
type CloseFunc func()
CloseFunc can be called to cleanup the master
func RunAMaster ¶
func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc)
RunAMaster starts a master with the provided config.
func RunAMasterUsingServer ¶ added in v1.5.0
func RunAMasterUsingServer(masterConfig *controlplane.Config, s *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc)
RunAMasterUsingServer starts up a master using the provided config on the specified server.
type Config ¶
type Config struct { // If nil, a default is used, partially filled configs will not get populated. MasterConfig *controlplane.Config StartReplicationManager bool // Client throttling qps QPS float32 // Client burst qps, also burst replicas allowed in rc manager Burst int }
Config is a struct of configuration directives for NewMasterComponents.
type IntegrationTestNodePreparer ¶ added in v1.5.0
type IntegrationTestNodePreparer struct {
// contains filtered or unexported fields
}
IntegrationTestNodePreparer holds configuration information for the test node preparer.
func (*IntegrationTestNodePreparer) CleanupNodes ¶ added in v1.5.0
func (p *IntegrationTestNodePreparer) CleanupNodes() error
CleanupNodes deletes existing test nodes.
func (*IntegrationTestNodePreparer) PrepareNodes ¶ added in v1.5.0
func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error
PrepareNodes prepares countToStrategy test nodes.
type MasterConfigOptions ¶ added in v1.15.0
type MasterConfigOptions struct {
EtcdOptions *options.EtcdOptions
}
MasterConfigOptions are the configurable options for a new integration test master config.
type MasterHolder ¶ added in v1.5.0
type MasterHolder struct { Initialized chan struct{} M *controlplane.Instance }
MasterHolder implements
func (*MasterHolder) SetMaster ¶ added in v1.5.0
func (h *MasterHolder) SetMaster(m *controlplane.Instance)
SetMaster assigns the current master.
type MasterReceiver ¶ added in v1.5.0
type MasterReceiver interface {
SetMaster(m *controlplane.Instance)
}
MasterReceiver can be used to provide the master to a custom incoming server function
type TestServerSetup ¶ added in v1.11.8
type TestServerSetup struct { ModifyServerRunOptions func(*options.ServerRunOptions) ModifyServerConfig func(*controlplane.Config) }
TestServerSetup holds configuration information for a kube-apiserver test server.