testutil

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestImageName = "test-image-for-kubeflow-tf-operator:latest"
	TestTFJobName = "test-tfjob"
	LabelWorker   = "worker"
	LabelPS       = "ps"
	LabelChief    = "chief"
	TFJobKind     = "TFJob"

	SleepInterval = 500 * time.Millisecond
	ThreadCount   = 1
)
View Source
const (
	LabelGroupName = "group-name"
	JobNameLabel   = "job-name"
	// Deprecated label. Has to be removed later
	DeprecatedLabelTFJobName = "tf-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      = tfv1.GroupVersion.Group
	ControllerName = "tf-operator"
)
View Source
var (
	AlwaysReady = func() bool { return true }
)

Functions

func CheckCondition

func CheckCondition(tfJob *tfv1.TFJob, condition common.JobConditionType, reason string) bool

func ConvertTFJobToUnstructured

func ConvertTFJobToUnstructured(tfJob *tfv1.TFJob) (*unstructured.Unstructured, error)

ConvertTFJobToUnstructured uses function ToUnstructured to convert TFJob to Unstructured.

func GenLabels

func GenLabels(jobName string) map[string]string

func GenOwnerReference

func GenOwnerReference(tfjob *tfv1.TFJob) *metav1.OwnerReference

func GetKey

func GetKey(tfJob *tfv1.TFJob, t *testing.T) string

func NewBasePod

func NewBasePod(name string, tfJob *tfv1.TFJob) *v1.Pod

func NewBaseService

func NewBaseService(name string, tfJob *tfv1.TFJob, t *testing.T) *v1.Service

func NewPod

func NewPod(tfJob *tfv1.TFJob, typ string, index int) *v1.Pod

func NewPodList

func NewPodList(count int32, status v1.PodPhase, tfJob *tfv1.TFJob, typ string, start int32) []*v1.Pod

create count pods with the given phase for the given tfJob

func NewService

func NewService(tfJob *tfv1.TFJob, typ string, index int, t *testing.T) *v1.Service

func NewServiceList

func NewServiceList(count int32, tfJob *tfv1.TFJob, typ string, t *testing.T) []*v1.Service

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

func NewTFJob

func NewTFJob(worker, ps int) *tfv1.TFJob

func NewTFJobV2 added in v1.1.0

func NewTFJobV2(worker, ps, master, cheif, evaluator int) *tfv1.TFJob

func NewTFJobWithActiveDeadlineSeconds

func NewTFJobWithActiveDeadlineSeconds(chief, worker, ps int, ads *int64) *tfv1.TFJob

func NewTFJobWithBackoffLimit

func NewTFJobWithBackoffLimit(chief, worker, ps int, backoffLimit *int32) *tfv1.TFJob

func NewTFJobWithChief

func NewTFJobWithChief(worker, ps int) *tfv1.TFJob

func NewTFJobWithCleanPolicy

func NewTFJobWithCleanPolicy(chief, worker, ps int, policy commonv1.CleanPodPolicy) *tfv1.TFJob

func NewTFJobWithCleanupJobDelay

func NewTFJobWithCleanupJobDelay(chief, worker, ps int, ttl *int32) *tfv1.TFJob

func NewTFJobWithEvaluator

func NewTFJobWithEvaluator(worker, ps, evaluator int) *tfv1.TFJob

func NewTFJobWithEvaluatorAndNamespace

func NewTFJobWithEvaluatorAndNamespace(worker, ps, evaluator int, ns string) *tfv1.TFJob

func NewTFJobWithNamespace

func NewTFJobWithNamespace(worker, ps int, ns string) *tfv1.TFJob

func NewTFJobWithSuccessPolicy added in v1.1.0

func NewTFJobWithSuccessPolicy(worker, ps int, successPolicy tfv1.SuccessPolicy) *tfv1.TFJob

func NewTFReplicaSpecTemplate

func NewTFReplicaSpecTemplate() v1.PodTemplateSpec

func SetPodsStatuses

func SetPodsStatuses(podIndexer cache.Indexer, tfJob *tfv1.TFJob, typ string, pendingPods, activePods, succeededPods, failedPods int32, restartCounts []int32, t *testing.T)

func SetServices

func SetServices(serviceIndexer cache.Indexer, tfJob *tfv1.TFJob, typ string, activeWorkerServices int32, t *testing.T)

func SetTFJobCompletionTime

func SetTFJobCompletionTime(tfJob *tfv1.TFJob)

Types

This section is empty.

Jump to

Keyboard shortcuts

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