From 1808a2b6a981cd3a13f2e3cce1be18f87a07bd64 Mon Sep 17 00:00:00 2001 From: Danny Clark Date: Mon, 13 Jan 2025 19:10:18 +0000 Subject: [PATCH] wip2 Change-Id: I1438ae4affc31640ae243ce79e6d3f7688b12e41 --- .../pkg/transformation/kubernetes_test.go | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/internal/pkg/transformation/kubernetes_test.go b/internal/pkg/transformation/kubernetes_test.go index 73dda955..325dceeb 100644 --- a/internal/pkg/transformation/kubernetes_test.go +++ b/internal/pkg/transformation/kubernetes_test.go @@ -20,13 +20,8 @@ import ( "fmt" "testing" - "testing" - "github.com/sirupsen/logrus" - mockdeviceinfo "github.com/NVIDIA/dcgm-exporter/internal/mocks/pkg/deviceinfo" - - mocknvmlprovider "github.com/NVIDIA/dcgm-exporter/internal/mocks/pkg/nvmlprovider" "github.com/NVIDIA/go-dcgm/pkg/dcgm" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -34,6 +29,8 @@ import ( "google.golang.org/grpc" podresourcesapi "k8s.io/kubelet/pkg/apis/podresources/v1alpha1" + mockdeviceinfo "github.com/NVIDIA/dcgm-exporter/internal/mocks/pkg/deviceinfo" + mocknvmlprovider "github.com/NVIDIA/dcgm-exporter/internal/mocks/pkg/nvmlprovider" "github.com/NVIDIA/dcgm-exporter/internal/pkg/appconfig" "github.com/NVIDIA/dcgm-exporter/internal/pkg/collector" "github.com/NVIDIA/dcgm-exporter/internal/pkg/counters" @@ -46,7 +43,6 @@ import ( func TestProcessPodMapper_WithD_Different_Format_Of_DeviceID(t *testing.T) { testutils.RequireLinux(t) logrus.SetLevel(logrus.DebugLevel) - type TestCase struct { KubernetesGPUIDType appconfig.KubernetesGPUIDType GPUInstanceID uint @@ -130,6 +126,20 @@ func TestProcessPodMapper_WithD_Different_Format_Of_DeviceID(t *testing.T) { PODGPUIDs: []string{"b8ea3855-276c-c9cb-b366-c6fa655957c5"}, KubernetesVirtualGPU: true, }, + { + KubernetesGPUIDType: appconfig.DeviceName, + ResourceName: appconfig.NvidiaResourceName, + MetricMigProfile: "1g.10gb", + GPUInstanceID: 0, + PODGPUIDs: []string{"nvidia0/gi0/vgpu0"}, + }, + { + KubernetesGPUIDType: appconfig.DeviceName, + ResourceName: appconfig.NvidiaResourceName, + MetricMigProfile: "1g.10gb", + GPUInstanceID: 1, + PODGPUIDs: []string{"nvidia0/gi1/vgpu0"}, + }, { KubernetesGPUIDType: appconfig.GPUUID, ResourceName: appconfig.NvidiaResourceName,