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" )
AddTaintToNode add taints to specific node
CleanupNodes cleans all nodes which were created during integration test
CleanupPods deletes the given pods and waits for them to be actually deleted.
CleanupTest cleans related resources which were created during integration test
func CreateAlgorithmSourceFromPolicy(policy *schedulerapi.Policy, clientSet clientset.Interface) schedulerapi.SchedulerAlgorithmSource
CreateAlgorithmSourceFromPolicy creates the schedulerAlgorithmSource from the policy parameter
GetTolerationSeconds gets the period of time the toleration
NewMockGCECloud returns a handle to a Cloud instance that is served by a mock http server
NodeCopyWithConditions duplicates the ode object with conditions
NodeReadyStatus returns the status of first condition with type NodeReady. If none of the condition is of type NodeReady, returns an error.
NodeTainted return a condition function that returns true if the given node contains the taints.
PodDeleted returns true if a pod is not found in the given namespace.
PodScheduled checks if the pod has been scheduled
RemoveTaintOffNode removes a specific taint from a node
SyncInformerFactory starts informer and waits for caches to be synced
UpdateNodeStatus updates the status of node.
WaitForNodeTaints waits for a node to have the target taints and returns an error if it does not have taints within the given timeout.
WaitForPodToSchedule waits for a pod to get scheduled and returns an error if it does not get scheduled within the timeout duration (30 seconds).
WaitForPodToScheduleWithTimeout waits for a pod to get scheduled and returns an error if it does not scheduled within the given timeout.
WaitForSchedulerCacheCleanup waits for cleanup of scheduler's cache to complete
type ShutdownFunc func()
ShutdownFunc represents the function handle to be called, typically in a defer handler, to shutdown a running module
StartApiserver starts a local API server for testing and returns the handle to the URL and the shutdown function to stop it.
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(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.
TestContext store necessary context info
InitTestMaster initializes a test environment and creates a master with default configuration.
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( 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.