package framework
import "k8s.io/kubernetes/test/integration/framework"
Index ¶
- Constants
- Variables
- func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace
- func DefaultEtcdOptions() *options.EtcdOptions
- func DefaultOpenAPIConfig() *openapicommon.Config
- func DefaultOpenAPIV3Config() *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 NewControlPlaneConfig() *controlplane.Config
- func NewControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config
- func NewIntegrationTestControlPlaneConfig() *controlplane.Config
- func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config
- func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeNamePrefix string) testutils.TestNodePreparer
- func NewIntegrationTestNodePreparerWithNodeSpec(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeSpec *v1.Node) testutils.TestNodePreparer
- 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 APIServerHolder
- type APIServerReceiver
- type CloseFunc
- func RunAnAPIServer(controlPlaneConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc)
- func RunAnAPIServerUsingServer(controlPlaneConfig *controlplane.Config, s *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc)
- type Config
- type ControlPlaneConfigOptions
- type IntegrationTestNodePreparer
- func (p *IntegrationTestNodePreparer) CleanupNodes() error
- func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error
- type TestServerSetup
Constants ¶
const (
UnprivilegedUserToken = "unprivileged-user"
)
Variables ¶
var MinVerbosity = 4
MinVerbosity determines the minimum klog verbosity when running tests that involve the apiserver. This overrides the -v value from the command line, i.e. -v=0 has no effect when MinVerbosity is 4 (the default). Tests can opt out of this by setting MinVerbosity to zero before starting the control plane or choose some different minimum verbosity.
Functions ¶
func CreateTestingNamespace ¶
func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace
CreateTestingNamespace creates a namespace for testing.
func DefaultEtcdOptions ¶
func DefaultEtcdOptions() *options.EtcdOptions
DefaultEtcdOptions are the default EtcdOptions for use with integration tests.
func DefaultOpenAPIConfig ¶
func DefaultOpenAPIConfig() *openapicommon.Config
DefaultOpenAPIConfig returns an openapicommon.Config initialized to default values.
func DefaultOpenAPIV3Config ¶
func DefaultOpenAPIV3Config() *openapicommon.Config
DefaultOpenAPIV3Config returns an openapicommon.Config initialized to default values.
func DeleteTestingNamespace ¶
DeleteTestingNamespace is currently a no-op function.
func EtcdMain ¶
func EtcdMain(tests func() int)
EtcdMain starts an etcd instance before running tests.
func Filter ¶
Filter filters nodes in NodeList in place, removing nodes that do not satisfy the given condition
func GetEtcdURL ¶
func GetEtcdURL() string
GetEtcdURL returns the URL of the etcd instance started by EtcdMain.
func GetReadySchedulableNodes ¶
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 ¶
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 ¶
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 ¶
IsNodeReady returns true if: 1) it's Ready condition is set to true 2) doesn't have NetworkUnavailable condition set to true
func IsNodeSchedulable ¶
IsNodeSchedulable returns true if: 1) doesn't have "unschedulable" field set 2) it also returns true from IsNodeReady
func NewControlPlaneConfig ¶
func NewControlPlaneConfig() *controlplane.Config
NewControlPlaneConfig returns a basic control plane config.
func NewControlPlaneConfigWithOptions ¶
func NewControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config
NewControlPlaneConfigWithOptions returns a basic control plane config configured with the provided options.
func NewIntegrationTestControlPlaneConfig ¶
func NewIntegrationTestControlPlaneConfig() *controlplane.Config
NewIntegrationTestControlPlaneConfig returns the control plane config appropriate for most integration tests.
func NewIntegrationTestControlPlaneConfigWithOptions ¶
func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config
NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests configured with the provided options.
func NewIntegrationTestNodePreparer ¶
func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeNamePrefix string) testutils.TestNodePreparer
NewIntegrationTestNodePreparer creates an IntegrationTestNodePreparer configured with defaults.
func NewIntegrationTestNodePreparerWithNodeSpec ¶
func NewIntegrationTestNodePreparerWithNodeSpec(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeSpec *v1.Node) testutils.TestNodePreparer
NewIntegrationTestNodePreparerWithNodeSpec creates an IntegrationTestNodePreparer configured with nodespec.
func RunCustomEtcd ¶
RunCustomEtcd starts a custom etcd instance for test purposes.
func SharedEtcd ¶
func SharedEtcd() *storagebackend.Config
SharedEtcd creates a storage config for a shared etcd instance, with a unique prefix.
func StartTestServer ¶
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 APIServerHolder ¶
type APIServerHolder struct { Initialized chan struct{} M *controlplane.Instance }
APIServerHolder implements
func (*APIServerHolder) SetAPIServer ¶
func (h *APIServerHolder) SetAPIServer(m *controlplane.Instance)
SetAPIServer assigns the current API server.
type APIServerReceiver ¶
type APIServerReceiver interface { SetAPIServer(m *controlplane.Instance) }
APIServerReceiver can be used to provide the API server to a custom incoming server function
type CloseFunc ¶
type CloseFunc func()
CloseFunc can be called to cleanup the API server
func RunAnAPIServer ¶
func RunAnAPIServer(controlPlaneConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc)
RunAnAPIServer starts a API server with the provided config.
func RunAnAPIServerUsingServer ¶
func RunAnAPIServerUsingServer(controlPlaneConfig *controlplane.Config, s *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc)
RunAnAPIServerUsingServer starts up an instance 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. InstanceConfig *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 NewControlPlaneComponents.
type ControlPlaneConfigOptions ¶
type ControlPlaneConfigOptions struct { EtcdOptions *options.EtcdOptions }
ControlPlaneConfigOptions are the configurable options for a new integration test control plane config.
type IntegrationTestNodePreparer ¶
type IntegrationTestNodePreparer struct {
// contains filtered or unexported fields
}
IntegrationTestNodePreparer holds configuration information for the test node preparer.
func (*IntegrationTestNodePreparer) CleanupNodes ¶
func (p *IntegrationTestNodePreparer) CleanupNodes() error
CleanupNodes deletes existing test nodes.
func (*IntegrationTestNodePreparer) PrepareNodes ¶
func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error
PrepareNodes prepares countToStrategy test nodes.
type TestServerSetup ¶
type TestServerSetup struct { ModifyServerRunOptions func(*options.ServerRunOptions) ModifyServerConfig func(*controlplane.Config) }
TestServerSetup holds configuration information for a kube-apiserver test server.
Source Files ¶
controlplane_utils.go etcd.go flags.go perf_utils.go serializer.go test_server.go util.go
- Version
- v1.24.2
- Published
- Jun 15, 2022
- Platform
- js/wasm
- Imports
- 63 packages
- Last checked
- 2 minutes ago –
Tools for package owners.