kubernetes: k8s.io/kubernetes/test/integration/util Index | Files

package util

import "k8s.io/kubernetes/test/integration/util"

Index

Package Files

cloud.go util.go

Constants

const (
    // TestProjectID is the project id used for creating NewMockGCECloud
    TestProjectID = "test-project"
    // TestNetworkProjectID is the network project id for creating NewMockGCECloud
    TestNetworkProjectID = "net-test-project"
    // TestRegion is the region for creating NewMockGCECloud
    TestRegion = "test-region"
    // TestZone is the zone for creating NewMockGCECloud
    TestZone = "test-zone"
    // TestNetworkName is the network name for creating NewMockGCECloud
    TestNetworkName = "test-network"
    // TestSubnetworkName is the sub network name for creating NewMockGCECloud
    TestSubnetworkName = "test-sub-network"
    // TestSecondaryRangeName is the secondary range name for creating NewMockGCECloud
    TestSecondaryRangeName = "test-secondary-range"
)

func AddTaintToNode Uses

func AddTaintToNode(cs clientset.Interface, nodeName string, taint v1.Taint) error

AddTaintToNode add taints to specific node

func CleanupNodes Uses

func CleanupNodes(cs clientset.Interface, t *testing.T)

CleanupNodes cleans all nodes which were created during integration test

func CleanupPods Uses

func CleanupPods(cs clientset.Interface, t *testing.T, pods []*v1.Pod)

CleanupPods deletes the given pods and waits for them to be actually deleted.

func CleanupTest Uses

func CleanupTest(t *testing.T, testCtx *TestContext)

CleanupTest cleans related resources which were created during integration test

func CreateAlgorithmSourceFromPolicy Uses

func CreateAlgorithmSourceFromPolicy(policy *schedulerapi.Policy, clientSet clientset.Interface) schedulerapi.SchedulerAlgorithmSource

CreateAlgorithmSourceFromPolicy creates the schedulerAlgorithmSource from the policy parameter

func GetTolerationSeconds Uses

func GetTolerationSeconds(tolerations []v1.Toleration) (int64, error)

GetTolerationSeconds gets the period of time the toleration

func NewMockGCECloud Uses

func NewMockGCECloud(cloud cloud.Cloud) (*gce.Cloud, error)

NewMockGCECloud returns a handle to a Cloud instance that is served by a mock http server

func NodeCopyWithConditions Uses

func NodeCopyWithConditions(node *v1.Node, conditions []v1.NodeCondition) *v1.Node

NodeCopyWithConditions duplicates the ode object with conditions

func NodeReadyStatus Uses

func NodeReadyStatus(conditions []v1.NodeCondition) (v1.ConditionStatus, error)

NodeReadyStatus returns the status of first condition with type NodeReady. If none of the condition is of type NodeReady, returns an error.

func NodeTainted Uses

func NodeTainted(cs clientset.Interface, nodeName string, taints []v1.Taint) wait.ConditionFunc

NodeTainted return a condition function that returns true if the given node contains the taints.

func PodDeleted Uses

func PodDeleted(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc

PodDeleted returns true if a pod is not found in the given namespace.

func PodScheduled Uses

func PodScheduled(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc

PodScheduled checks if the pod has been scheduled

func RemoveTaintOffNode Uses

func RemoveTaintOffNode(cs clientset.Interface, nodeName string, taint v1.Taint) error

RemoveTaintOffNode removes a specific taint from a node

func SyncInformerFactory Uses

func SyncInformerFactory(testCtx *TestContext)

SyncInformerFactory starts informer and waits for caches to be synced

func UpdateNodeStatus Uses

func UpdateNodeStatus(cs clientset.Interface, node *v1.Node) error

UpdateNodeStatus updates the status of node.

func WaitForNodeTaints Uses

func WaitForNodeTaints(cs clientset.Interface, node *v1.Node, taints []v1.Taint) error

WaitForNodeTaints waits for a node to have the target taints and returns an error if it does not have taints within the given timeout.

func WaitForPodToSchedule Uses

func WaitForPodToSchedule(cs clientset.Interface, pod *v1.Pod) error

WaitForPodToSchedule waits for a pod to get scheduled and returns an error if it does not get scheduled within the timeout duration (30 seconds).

func WaitForPodToScheduleWithTimeout Uses

func WaitForPodToScheduleWithTimeout(cs clientset.Interface, pod *v1.Pod, timeout time.Duration) error

WaitForPodToScheduleWithTimeout waits for a pod to get scheduled and returns an error if it does not scheduled within the given timeout.

func WaitForSchedulerCacheCleanup Uses

func WaitForSchedulerCacheCleanup(sched *scheduler.Scheduler, t *testing.T)

WaitForSchedulerCacheCleanup waits for cleanup of scheduler's cache to complete

type ShutdownFunc Uses

type ShutdownFunc func()

ShutdownFunc represents the function handle to be called, typically in a defer handler, to shutdown a running module

func StartApiserver Uses

func StartApiserver() (string, ShutdownFunc)

StartApiserver starts a local API server for testing and returns the handle to the URL and the shutdown function to stop it.

func StartFakePVController Uses

func StartFakePVController(clientSet clientset.Interface) ShutdownFunc

StartFakePVController is a simplified pv controller logic that sets PVC VolumeName and annotation for each PV binding. TODO(mborsz): Use a real PV controller here.

func StartScheduler Uses

func StartScheduler(clientSet clientset.Interface) (*scheduler.Scheduler, coreinformers.PodInformer, ShutdownFunc)

StartScheduler configures and starts a scheduler given a handle to the clientSet interface and event broadcaster. It returns the running scheduler and the shutdown function to stop it.

type TestContext Uses

type TestContext struct {
    CloseFn         framework.CloseFunc
    HTTPServer      *httptest.Server
    NS              *v1.Namespace
    ClientSet       *clientset.Clientset
    InformerFactory informers.SharedInformerFactory
    Scheduler       *scheduler.Scheduler
    Ctx             context.Context
    CancelFn        context.CancelFunc
}

TestContext store necessary context info

func InitTestMaster Uses

func InitTestMaster(t *testing.T, nsPrefix string, admission admission.Interface) *TestContext

InitTestMaster initializes a test environment and creates a master with default configuration.

func InitTestScheduler Uses

func InitTestScheduler(
    t *testing.T,
    testCtx *TestContext,
    setPodInformer bool,
    policy *schedulerapi.Policy,
) *TestContext

InitTestScheduler initializes a test environment and creates a scheduler with default configuration.

func InitTestSchedulerWithOptions Uses

func InitTestSchedulerWithOptions(
    t *testing.T,
    testCtx *TestContext,
    setPodInformer bool,
    policy *schedulerapi.Policy,
    resyncPeriod time.Duration,
    opts ...scheduler.Option,
) *TestContext

InitTestSchedulerWithOptions initializes a test environment and creates a scheduler with default configuration and other options.

Package util imports 33 packages (graph) and is imported by 13 packages. Updated 2020-07-10. Refresh now. Tools for package owners.