support

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeFlareSDKVersion = "0.10.0"
	RayVersion          = "2.5.0"
	RayImage            = "rayproject/ray:2.5.0"
)
View Source
const (
	CodeFlareTestSdkVersion   = "CODEFLARE_TEST_SDK_VERSION"
	CodeFlareTestRayVersion   = "CODEFLARE_TEST_RAY_VERSION"
	CodeFlareTestRayImage     = "CODEFLARE_TEST_RAY_IMAGE"
	CodeFlareTestPyTorchImage = "CODEFLARE_TEST_PYTORCH_IMAGE"

	// The testing output directory, to write output files into.
	CodeFlareTestOutputDir = "CODEFLARE_TEST_OUTPUT_DIR"

	// The namespace where a secret containing InstaScale OCM token is stored and the secret name.
	InstaScaleOcmSecret = "INSTASCALE_OCM_SECRET"

	// Cluster ID for OSD cluster used in tests, used for testing InstaScale
	OsdClusterID = "CLUSTERID"

	// Type of cluster test is run on
	ClusterTypeEnvVar = "CLUSTER_TYPE"
)
View Source
const RayJobDefaultClusterSelectorKey = "ray.io/cluster"

Variables

View Source
var (
	ApplyOptions = metav1.ApplyOptions{FieldManager: "codeflare-test", Force: true}

	TestTimeoutShort           = 1 * time.Minute
	TestTimeoutMedium          = 2 * time.Minute
	TestTimeoutLong            = 5 * time.Minute
	TestTimeoutGpuProvisioning = 30 * time.Minute
)

Functions

func AppWrapper

func AppWrapper(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *mcadv1beta1.AppWrapper

func AppWrapperName added in v0.2.3

func AppWrapperName(aw *mcadv1beta1.AppWrapper) string

func AppWrappers added in v0.2.3

func AppWrappers(t Test, namespace *corev1.Namespace) func(g gomega.Gomega) []*mcadv1beta1.AppWrapper

func ConditionStatus

func ConditionStatus[T conditionType](conditionType T) func(any) corev1.ConditionStatus

func CreateConfigMap

func CreateConfigMap(t Test, namespace string, content map[string][]byte) *corev1.ConfigMap

func CreateOCMConnection

func CreateOCMConnection(test Test) *ocmsdk.Connection

func ExposeService

func ExposeService(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func ExposeServiceByIngress

func ExposeServiceByIngress(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func ExposeServiceByRoute

func ExposeServiceByRoute(t Test, name string, namespace string, serviceName string, servicePort string) url.URL

func GetCodeFlareSDKVersion

func GetCodeFlareSDKVersion() string

func GetIngress added in v0.2.0

func GetIngress(t Test, namespace, name string) *networkingv1.Ingress

func GetInstascaleOcmSecret

func GetInstascaleOcmSecret() (string, string)

func GetJob

func GetJob(t Test, namespace, name string) *batchv1.Job

func GetMachinePools

func GetMachinePools(t Test, connection *ocmsdk.Connection) []*cmv1.MachinePool

func GetMachineSets

func GetMachineSets(t Test) ([]machinev1beta1.MachineSet, error)

func GetMachines

func GetMachines(t Test, machineSetName string) []machinev1beta1.Machine

func GetOsdClusterId

func GetOsdClusterId() (string, bool)

func GetPodLogs

func GetPodLogs(t Test, pod *corev1.Pod, options corev1.PodLogOptions) []byte

func GetPods

func GetPods(t Test, namespace string, options metav1.ListOptions) []corev1.Pod

func GetPyTorchImage

func GetPyTorchImage() string

func GetRayCluster added in v0.1.0

func GetRayCluster(t Test, namespace, name string) *rayv1.RayCluster

func GetRayImage

func GetRayImage() string

func GetRayJob

func GetRayJob(t Test, namespace, name string) *rayv1.RayJob

func GetRayJobAPIDetailsStatus added in v0.1.0

func GetRayJobAPIDetailsStatus(jobDetails *RayJobDetailsResponse) string

func GetRayJobId added in v0.2.0

func GetRayJobId(t Test, namespace, name string) string

func GetRayVersion

func GetRayVersion() string

func GetRoute added in v0.2.0

func GetRoute(t Test, namespace, name string) *routev1.Route

func Ingress added in v0.2.0

func Ingress(t Test, namespace, name string) func(g gomega.Gomega) *networkingv1.Ingress

func IsOpenShift

func IsOpenShift(test Test) bool

func Job

func Job(t Test, namespace, name string) func(g gomega.Gomega) *batchv1.Job

func LoadBalancerIngresses added in v0.2.0

func LoadBalancerIngresses(ingress *networkingv1.Ingress) []networkingv1.IngressLoadBalancerIngress

func MachinePoolId

func MachinePoolId(machinePool *cmv1.MachinePool) string

func MachinePools

func MachinePools(t Test, connection *ocmsdk.Connection) func(g gomega.Gomega) []*cmv1.MachinePool

func MachineSetId

func MachineSetId(machineSet machinev1beta1.MachineSet) string

func Machines

func Machines(t Test, machineSetName string) func(g gomega.Gomega) []machinev1beta1.Machine

func Ptr

func Ptr[T any](v T) *T

func Raw

func RayCluster added in v0.1.0

func RayCluster(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayCluster

func RayClusterState added in v0.1.0

func RayClusterState(cluster *rayv1.RayCluster) rayv1.ClusterState

func RayJob

func RayJob(t Test, namespace, name string) func(g gomega.Gomega) *rayv1.RayJob

func RayJobAPIDetails added in v0.1.0

func RayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) func(g gomega.Gomega) *RayJobDetailsResponse

func RayJobStatus

func RayJobStatus(job *rayv1.RayJob) rayv1.JobStatus

func Route added in v0.1.0

func Route(t Test, namespace, name string) func(g gomega.Gomega) *routev1.Route

func WriteRayJobAPILogs added in v0.1.0

func WriteRayJobAPILogs(t Test, rayClient RayClusterClient, jobID string)

func WriteRayJobLogs

func WriteRayJobLogs(t Test, rayClient RayClusterClient, namespace, name string)

func WriteToOutputDir

func WriteToOutputDir(t Test, fileName string, fileType OutputType, data []byte)

Types

type Client

type Client interface {
	Core() kubernetes.Interface
	Machine() machinev1.Interface
	Route() routev1.Interface
	Image() imagev1.Interface
	MCAD() mcadclient.Interface
	Ray() rayclient.Interface
	Dynamic() dynamic.Interface
}

type ClusterType

type ClusterType string
const (
	OsdCluster        ClusterType = "OSD"
	OcpCluster        ClusterType = "OCP"
	HypershiftCluster ClusterType = "HYPERSHIFT"
	UndefinedCluster  ClusterType = "UNDEFINED"
)

func GetClusterType

func GetClusterType(t Test) ClusterType

type Option

type Option[T any] interface {
	// contains filtered or unexported methods
}

type OutputType

type OutputType string
const (
	Log OutputType = "log"
)

type RayClusterClient added in v0.1.0

type RayClusterClient interface {
	CreateJob(job *RayJobSetup) (*RayJobResponse, error)
	GetJobDetails(jobID string) (*RayJobDetailsResponse, error)
	GetJobLogs(jobID string) (string, error)
}

func NewRayClusterClient added in v0.1.0

func NewRayClusterClient(dashboardEndpoint url.URL) RayClusterClient

type RayJobDetailsResponse added in v0.1.0

type RayJobDetailsResponse struct {
	JobID        string `json:"job_id"`
	SubmissionID string `json:"submission_id"`
	Status       string `json:"status"`
}

func GetRayJobAPIDetails added in v0.1.0

func GetRayJobAPIDetails(t Test, rayClient RayClusterClient, jobID string) *RayJobDetailsResponse

type RayJobLogsResponse added in v0.1.0

type RayJobLogsResponse struct {
	Logs string `json:"logs"`
}

type RayJobResponse added in v0.1.0

type RayJobResponse struct {
	JobID        string `json:"job_id"`
	SubmissionID string `json:"submission_id"`
}

type RayJobSetup added in v0.1.0

type RayJobSetup struct {
	EntryPoint string         `json:"entrypoint"`
	RuntimeEnv map[string]any `json:"runtime_env"`
}

type T

type T struct {
	*gomega.WithT
	// contains filtered or unexported fields
}

func (*T) Client

func (t *T) Client() Client

func (*T) Ctx

func (t *T) Ctx() context.Context

func (*T) NewTestNamespace

func (t *T) NewTestNamespace(options ...Option[*corev1.Namespace]) *corev1.Namespace

func (*T) OutputDir

func (t *T) OutputDir() string

func (*T) T

func (t *T) T() *testing.T

type Test

type Test interface {
	T() *testing.T
	Ctx() context.Context
	Client() Client
	OutputDir() string

	gomega.Gomega

	NewTestNamespace(...Option[*corev1.Namespace]) *corev1.Namespace
}

func With

func With(t *testing.T) Test

Jump to

Keyboard shortcuts

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