uthelper

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](elements []T, key T) bool

Contains compares a key in a slice and returns true if exist in it

func RegistPlugins

func RegistPlugins(plugins map[string]framework.PluginBuilder)

RegistPlugins plugins

Types

type Interface

type Interface interface {
	// Run executes the actions
	Run(actions []framework.Action)
	// RegistSession init the session
	RegistSession(tiers []conf.Tier, config []conf.Configuration) *framework.Session
	// Close release session and do cleanup
	Close()
	// CheckAll do all checks
	CheckAll(caseIndex int) (err error)
	// CheckBind just check bind results in allocate action
	CheckBind(caseIndex int) error
	// CheckEvict just check evict results in preempt or reclaim action
	CheckEvict(caseIndex int) error
	// CheckPipelined check the pipelined results
	CheckPipelined(caseIndex int) error
	// CheckPGStatus check job's status
	CheckPGStatus(caseIndex int) error
}

Interface is UT framework interface

type TestCommonStruct

type TestCommonStruct struct {
	Name      string
	Plugins   map[string]framework.PluginBuilder // plugins for each case
	Pods      []*v1.Pod
	Nodes     []*v1.Node
	PodGroups []*vcapisv1.PodGroup
	Queues    []*vcapisv1.Queue
	PriClass  []*schedulingv1.PriorityClass
	Bind      map[string]string                      // bind results: ns/podName -> nodeName
	PipeLined map[string][]string                    // pipelined results: map[jobID][]{nodename}
	Evicted   []string                               // evicted pods list of ns/podName
	Status    map[api.JobID]scheduling.PodGroupPhase // final status
	BindsNum  int                                    // binds events numbers
	EvictNum  int                                    // evict events numbers, include preempted and reclaimed evict events
	// contains filtered or unexported fields
}

TestCommonStruct is the most common used resource when do UT others can wrap it in a new struct

func (*TestCommonStruct) CheckAll

func (test *TestCommonStruct) CheckAll(caseIndex int) (err error)

CheckAll checks all the need status

func (*TestCommonStruct) CheckBind

func (test *TestCommonStruct) CheckBind(caseIndex int) error

CheckBind check expected bind result

func (*TestCommonStruct) CheckEvict

func (test *TestCommonStruct) CheckEvict(caseIndex int) error

CheckEvict check the evicted result

func (*TestCommonStruct) CheckPGStatus

func (test *TestCommonStruct) CheckPGStatus(caseIndex int) error

CheckPGStatus check job's podgroups status

func (*TestCommonStruct) CheckPipelined

func (test *TestCommonStruct) CheckPipelined(caseIndex int) error

CheckPipelined checks pipeline results

func (*TestCommonStruct) Close

func (test *TestCommonStruct) Close()

Close do release resource and clean up

func (*TestCommonStruct) RegistSession

func (test *TestCommonStruct) RegistSession(tiers []conf.Tier, config []conf.Configuration) *framework.Session

RegistSession open session with tiers and configuration, and mock schedulerCache with self-defined FakeBinder and FakeEvictor

func (*TestCommonStruct) Run

func (test *TestCommonStruct) Run(actions []framework.Action)

Run choose to run passed in actions; if no actions provided, will panic

Jump to

Keyboard shortcuts

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