testutil

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestImageName = "mxjob/mxnet-operator:v1beta1"
	TestMXJobName = "test-mxjob"

	LabelScheduler = "scheduler"
	LabelWorker    = "worker"
	LabelServer    = "server"

	SleepInterval = 500 * time.Millisecond
	ThreadCount   = 1
)
View Source
const (
	LabelGroupName = "group_name"
	LabelMXJobName = "mxnet_job_name"
)

Variables

View Source
var (
	// KeyFunc is the short name to DeletionHandlingMetaNamespaceKeyFunc.
	// IndexerInformer uses a delta queue, therefore for deletes we have to use this
	// key function but it should be just fine for non delete events.
	KeyFunc   = cache.DeletionHandlingMetaNamespaceKeyFunc
	GroupName = mxv1beta1.GroupName
)
View Source
var (
	AlwaysReady = func() bool { return true }
)

Functions

func CheckCondition

func CheckCondition(mxJob *mxv1beta1.MXJob, condition mxv1beta1.MXJobConditionType, reason string) bool

func ConvertMXJobToUnstructured

func ConvertMXJobToUnstructured(mxJob *mxv1beta1.MXJob) (*unstructured.Unstructured, error)

ConvertMXJobToUnstructured uses JSON to convert MXJob to Unstructured.

func GenLabels

func GenLabels(jobName string) map[string]string

func GenOwnerReference

func GenOwnerReference(mxjob *mxv1beta1.MXJob) *metav1.OwnerReference

func GetKey

func GetKey(mxJob *mxv1beta1.MXJob, t *testing.T) string

func NewBasePod

func NewBasePod(name string, mxJob *mxv1beta1.MXJob, t *testing.T) *v1.Pod

func NewBaseService

func NewBaseService(name string, mxJob *mxv1beta1.MXJob, t *testing.T) *v1.Service

func NewMXJob

func NewMXJob(worker, server int) *mxv1beta1.MXJob

func NewMXJobWithCleanPolicy

func NewMXJobWithCleanPolicy(scheduler, worker, server int, policy mxv1beta1.CleanPodPolicy) *mxv1beta1.MXJob

func NewMXJobWithCleanupJobDelay

func NewMXJobWithCleanupJobDelay(scheduler, worker, server int, ttl *int32) *mxv1beta1.MXJob

func NewMXJobWithScheduler

func NewMXJobWithScheduler(worker, server int) *mxv1beta1.MXJob

func NewMXJobWithSuccessPolicy added in v1.1.0

func NewMXJobWithSuccessPolicy(scheduler, worker, server int, policy mxv1beta1.SuccessPolicy) *mxv1beta1.MXJob

func NewMXReplicaSpecTemplate

func NewMXReplicaSpecTemplate() v1.PodTemplateSpec

func NewPod

func NewPod(mxJob *mxv1beta1.MXJob, typ string, index int, t *testing.T) *v1.Pod

func NewPodList

func NewPodList(count int32, status v1.PodPhase, mxJob *mxv1beta1.MXJob, typ string, start int32, t *testing.T) []*v1.Pod

create count pods with the given phase for the given mxJob

func NewService

func NewService(mxJob *mxv1beta1.MXJob, typ string, index int, t *testing.T) *v1.Service

func NewServiceList

func NewServiceList(count int32, mxJob *mxv1beta1.MXJob, typ string, t *testing.T) []*v1.Service

NewServiceList creates count pods with the given phase for the given mxJob

func SetMXJobCompletionTime

func SetMXJobCompletionTime(mxJob *mxv1beta1.MXJob)

func SetPodsStatuses

func SetPodsStatuses(podIndexer cache.Indexer, mxJob *mxv1beta1.MXJob, typ string, pendingPods, activePods, succeededPods, failedPods int32, t *testing.T)

func SetServices

func SetServices(serviceIndexer cache.Indexer, mxJob *mxv1beta1.MXJob, typ string, activeWorkerServices int32, t *testing.T)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL