Documentation
¶
Index ¶
- Variables
- func CreateTmpDir(t *testing.T) (string, func())
- func GetFields(input interface{}, fieldType FieldType) map[string]interface{}
- func GetStructPrivateFieldValue[T any](t *testing.T, v any, fieldName string) T
- func MockCPUDeviceInfo(ctrl *gomock.Controller, cpuCount int, cpuToCores map[int][]uint, ...) *mockdeviceinfo.MockProvider
- func MockGPUDeviceInfo(ctrl *gomock.Controller, gpuCount int, ...) *mockdeviceinfo.MockProvider
- func MockSwitchDeviceInfo(ctrl *gomock.Controller, switchCount int, ...) *mockdeviceinfo.MockProvider
- func RequireLinux(t *testing.T)
- func StartMockServer(t *testing.T, server *grpc.Server, socket string) func()
- func StrToByteArray(str string) [4096]byte
- type FieldType
- type MockPodResourcesServer
- type MockReader
- type WatchedEntityKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MockGPUInstanceInfo1 = deviceinfo.GPUInstanceInfo{ Info: dcgm.MigEntityInfo{GpuUuid: "fake", NvmlProfileSlices: 3}, ProfileName: fakeProfileName, EntityId: 0, } MockGPUInstanceInfo2 = deviceinfo.GPUInstanceInfo{ Info: dcgm.MigEntityInfo{GpuUuid: "fake", NvmlInstanceId: 1, NvmlProfileSlices: 3}, ProfileName: fakeProfileName, EntityId: 14, } MockNVLinkVal1 = dcgm.NvLinkStatus{ State: 2, Index: 0, } MockNVLinkVal2 = dcgm.NvLinkStatus{ State: 3, Index: 1, } )
View Source
var ( SampleGPUTempCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_GPU_TEMP, FieldName: "DCGM_FI_DEV_GPU_TEMP", PromType: "gauge", Help: "Temperature Help info", } SampleGPUTotalEnergyCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_TOTAL_ENERGY_CONSUMPTION, FieldName: "DCGM_FI_DEV_TOTAL_ENERGY_CONSUMPTION", PromType: "gauge", Help: "Energy help info", } SampleGPUPowerUsageCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_POWER_USAGE, FieldName: "DCGM_FI_DEV_POWER_USAGE", PromType: "gauge", Help: "Power help info", } SampleVGPULicenseStatusCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_VGPU_LICENSE_STATUS, FieldName: "DCGM_FI_DEV_VGPU_LICENSE_STATUS", PromType: "gauge", Help: "vgpu license status", } SampleDriverVersionCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DRIVER_VERSION, FieldName: "DCGM_FI_DRIVER_VERSION", PromType: "label", Help: "Driver version", } SampleSwitchCurrentTempCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_NVSWITCH_TEMPERATURE_CURRENT, FieldName: "DCGM_FI_DEV_NVSWITCH_TEMPERATURE_CURRENT", PromType: "gauge", Help: "switch temperature", } SampleSwitchLinkFlitErrorsCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_NVSWITCH_LINK_FLIT_ERRORS, FieldName: "DCGM_FI_DEV_NVSWITCH_LINK_FLIT_ERRORS", PromType: "gauge", Help: "per-link flit errors", } SampleCPUUtilTotalCounter = counters.Counter{ FieldID: dcgm.DCGM_FI_DEV_CPU_UTIL_TOTAL, FieldName: "DCGM_FI_DEV_CPU_UTIL_TOTAL", PromType: "gauge", Help: "Total CPU utilization", } SampleCounters = []counters.Counter{ SampleGPUTempCounter, SampleGPUTotalEnergyCounter, SampleGPUPowerUsageCounter, SampleDriverVersionCounter, SampleSwitchCurrentTempCounter, SampleSwitchLinkFlitErrorsCounter, SampleVGPULicenseStatusCounter, SampleCPUUtilTotalCounter, } SampleAllFieldIDs = []dcgm.Short{ SampleGPUTempCounter.FieldID, SampleGPUTotalEnergyCounter.FieldID, SampleGPUPowerUsageCounter.FieldID, SampleVGPULicenseStatusCounter.FieldID, SampleDriverVersionCounter.FieldID, SampleSwitchCurrentTempCounter.FieldID, SampleSwitchLinkFlitErrorsCounter.FieldID, SampleCPUUtilTotalCounter.FieldID, } SampleGPUFieldIDs = []dcgm.Short{ SampleGPUTempCounter.FieldID, SampleGPUTotalEnergyCounter.FieldID, SampleGPUPowerUsageCounter.FieldID, SampleVGPULicenseStatusCounter.FieldID, } SampleFieldIDToFieldMeta = map[dcgm.Short]dcgm.FieldMeta{ SampleGPUTempCounter.FieldID: { FieldId: SampleGPUTempCounter.FieldID, EntityLevel: dcgm.FE_GPU, }, SampleGPUTotalEnergyCounter.FieldID: { FieldId: SampleGPUTotalEnergyCounter.FieldID, EntityLevel: dcgm.FE_GPU, }, SampleGPUPowerUsageCounter.FieldID: { FieldId: SampleGPUPowerUsageCounter.FieldID, EntityLevel: dcgm.FE_GPU_I, }, SampleVGPULicenseStatusCounter.FieldID: { FieldId: SampleVGPULicenseStatusCounter.FieldID, EntityLevel: dcgm.FE_VGPU, }, SampleDriverVersionCounter.FieldID: { FieldId: SampleDriverVersionCounter.FieldID, EntityLevel: dcgm.FE_NONE, }, SampleSwitchCurrentTempCounter.FieldID: { FieldId: SampleSwitchCurrentTempCounter.FieldID, EntityLevel: dcgm.FE_SWITCH, }, SampleSwitchLinkFlitErrorsCounter.FieldID: { FieldId: SampleSwitchLinkFlitErrorsCounter.FieldID, EntityLevel: dcgm.FE_LINK, }, SampleCPUUtilTotalCounter.FieldID: { FieldId: SampleCPUUtilTotalCounter.FieldID, EntityLevel: dcgm.FE_CPU_CORE, }, } )
Functions ¶
func CreateTmpDir ¶
func GetFields ¶
GetFields returns a map of fields of a struct, including unexported fields, based on the specified field type.
func GetStructPrivateFieldValue ¶
GetStructPrivateFieldValue returns private field value
func MockCPUDeviceInfo ¶
func MockCPUDeviceInfo( ctrl *gomock.Controller, cpuCount int, cpuToCores map[int][]uint, watchedCPUs map[uint]bool, watchedCores map[WatchedEntityKey]bool, infoType dcgm.Field_Entity_Group, ) *mockdeviceinfo.MockProvider
func MockGPUDeviceInfo ¶
func MockGPUDeviceInfo( ctrl *gomock.Controller, gpuCount int, gpuToGpuInstanceInfos map[int][]deviceinfo.GPUInstanceInfo, ) *mockdeviceinfo.MockProvider
func MockSwitchDeviceInfo ¶
func MockSwitchDeviceInfo( ctrl *gomock.Controller, switchCount int, switchToNvLinks map[int][]dcgm.NvLinkStatus, watchedSwitches map[uint]bool, watchedLinks map[WatchedEntityKey]bool, infoType dcgm.Field_Entity_Group, ) *mockdeviceinfo.MockProvider
func RequireLinux ¶
RequireLinux checks if tests are being executed on a Linux platform or not
func StartMockServer ¶
func StrToByteArray ¶
Types ¶
type MockPodResourcesServer ¶
type MockPodResourcesServer struct {
// contains filtered or unexported fields
}
func NewMockPodResourcesServer ¶
func NewMockPodResourcesServer(resourceName string, gpus []string) *MockPodResourcesServer
func (*MockPodResourcesServer) List ¶
func (s *MockPodResourcesServer) List( ctx context.Context, req *v1alpha1.ListPodResourcesRequest, ) (*v1alpha1.ListPodResourcesResponse, error)
type MockReader ¶
type MockReader struct {
Err error
}
MockReader is a mock implementation of rand.Reader that always returns an error
type WatchedEntityKey ¶
Click to show internal directories.
Click to hide internal directories.