Documentation ¶
Index ¶
- Constants
- func AddTaintToNode(cs clientset.Interface, nodeName string, taint v1.Taint) error
- func CleanupNodes(cs clientset.Interface, t *testing.T)
- func CleanupPods(cs clientset.Interface, t *testing.T, pods []*v1.Pod)
- func CleanupTest(t *testing.T, testCtx *TestContext)
- func CreateAlgorithmSourceFromPolicy(policy *schedulerapi.Policy, clientSet clientset.Interface) schedulerapi.SchedulerAlgorithmSource
- func GetTolerationSeconds(tolerations []v1.Toleration) (int64, error)
- func NewMockGCECloud(cloud cloud.Cloud) (*gce.Cloud, error)
- func NodeCopyWithConditions(node *v1.Node, conditions []v1.NodeCondition) *v1.Node
- func NodeReadyStatus(conditions []v1.NodeCondition) (v1.ConditionStatus, error)
- func NodeTainted(cs clientset.Interface, nodeName string, taints []v1.Taint) wait.ConditionFunc
- func PodDeleted(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc
- func PodScheduled(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc
- func UpdateNodeStatus(cs clientset.Interface, node *v1.Node) error
- func WaitForNodeTaints(cs clientset.Interface, node *v1.Node, taints []v1.Taint) error
- func WaitForPodToSchedule(cs clientset.Interface, pod *v1.Pod) error
- func WaitForPodToScheduleWithTimeout(cs clientset.Interface, pod *v1.Pod, timeout time.Duration) error
- func WaitForSchedulerCacheCleanup(sched *scheduler.Scheduler, t *testing.T)
- type ShutdownFunc
- type TestContext
- func InitTestMaster(t *testing.T, nsPrefix string, admission admission.Interface) *TestContext
- func InitTestScheduler(t *testing.T, testCtx *TestContext, setPodInformer bool, ...) *TestContext
- func InitTestSchedulerWithOptions(t *testing.T, testCtx *TestContext, setPodInformer bool, ...) *TestContext
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" )
Variables ¶
This section is empty.
Functions ¶
func AddTaintToNode ¶ added in v1.18.0
AddTaintToNode add taints to specific node
func CleanupNodes ¶ added in v1.18.0
CleanupNodes cleans all nodes which were created during integration test
func CleanupPods ¶ added in v1.18.0
CleanupPods deletes the given pods and waits for them to be actually deleted.
func CleanupTest ¶ added in v1.18.0
func CleanupTest(t *testing.T, testCtx *TestContext)
CleanupTest cleans related resources which were created during integration test
func CreateAlgorithmSourceFromPolicy ¶ added in v1.18.0
func CreateAlgorithmSourceFromPolicy(policy *schedulerapi.Policy, clientSet clientset.Interface) schedulerapi.SchedulerAlgorithmSource
CreateAlgorithmSourceFromPolicy creates the schedulerAlgorithmSource from the policy parameter
func GetTolerationSeconds ¶ added in v1.18.0
func GetTolerationSeconds(tolerations []v1.Toleration) (int64, error)
GetTolerationSeconds gets the period of time the toleration
func NewMockGCECloud ¶ added in v1.11.0
NewMockGCECloud returns a handle to a Cloud instance that is served by a mock http server
func NodeCopyWithConditions ¶ added in v1.18.0
NodeCopyWithConditions duplicates the ode object with conditions
func NodeReadyStatus ¶ added in v1.18.0
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 ¶ added in v1.18.0
NodeTainted return a condition function that returns true if the given node contains the taints.
func PodDeleted ¶ added in v1.18.0
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 ¶ added in v1.18.0
func PodScheduled(c clientset.Interface, podNamespace, podName string) wait.ConditionFunc
PodScheduled checks if the pod has been scheduled
func UpdateNodeStatus ¶ added in v1.18.0
UpdateNodeStatus updates the status of node.
func WaitForNodeTaints ¶ added in v1.18.0
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 ¶ added in v1.18.0
WaitForPodToSchedule waits for a pod to get scheduled and returns an error if it does not get scheduled within the timeout duration (30 seconds).
Types ¶
type ShutdownFunc ¶
type ShutdownFunc func()
ShutdownFunc represents the function handle to be called, typically in a defer handler, to shutdown a running module
func StartApiserver ¶
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 ¶ added in v1.18.0
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 ¶
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 ¶ added in v1.18.0
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 ¶ added in v1.18.0
InitTestMaster initializes a test environment and creates a master with default configuration.
func InitTestScheduler ¶ added in v1.18.0
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 ¶ added in v1.18.0
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.