(t *testing.T)
| 4040 | } |
| 4041 | |
| 4042 | func TestTransformVGPUManager(t *testing.T) { |
| 4043 | node := &corev1.Node{ |
| 4044 | ObjectMeta: metav1.ObjectMeta{ |
| 4045 | Name: "test-node", |
| 4046 | Labels: map[string]string{ |
| 4047 | nfdOSReleaseIDLabelKey: "ubuntu", |
| 4048 | nfdOSVersionIDLabelKey: "24.04", |
| 4049 | nfdKernelLabelKey: "6.8.0-60-generic", |
| 4050 | commonGPULabelKey: "true", |
| 4051 | }, |
| 4052 | }, |
| 4053 | } |
| 4054 | |
| 4055 | kernelModuleConfigMap := &corev1.ConfigMap{ |
| 4056 | ObjectMeta: metav1.ObjectMeta{ |
| 4057 | Name: "vgpu-kernel-module-config", |
| 4058 | Namespace: "test-ns", |
| 4059 | }, |
| 4060 | Data: map[string]string{ |
| 4061 | "nvidia.conf": "options nvidia NVreg_EnableGpuFirmwareLogs=1\n", |
| 4062 | }, |
| 4063 | } |
| 4064 | |
| 4065 | mockClient := fake.NewFakeClient(node, kernelModuleConfigMap) |
| 4066 | |
| 4067 | testCases := []struct { |
| 4068 | description string |
| 4069 | daemonset Daemonset |
| 4070 | cpSpec *gpuv1.ClusterPolicySpec |
| 4071 | client client.Client |
| 4072 | errorExpected bool |
| 4073 | }{ |
| 4074 | { |
| 4075 | description: "transform vgpu manager with kernel module config", |
| 4076 | daemonset: NewDaemonset(). |
| 4077 | WithInitContainer(corev1.Container{Name: "k8s-driver-manager"}). |
| 4078 | WithContainer(corev1.Container{Name: "nvidia-vgpu-manager-ctr"}), |
| 4079 | cpSpec: &gpuv1.ClusterPolicySpec{ |
| 4080 | VGPUManager: gpuv1.VGPUManagerSpec{ |
| 4081 | Repository: "nvcr.io/nvidia", |
| 4082 | Image: "vgpu-manager", |
| 4083 | Version: "550.90.07", |
| 4084 | ImagePullPolicy: "IfNotPresent", |
| 4085 | DriverManager: gpuv1.DriverManagerSpec{ |
| 4086 | Repository: "nvcr.io/nvidia/cloud-native", |
| 4087 | Image: "k8s-driver-manager", |
| 4088 | ImagePullPolicy: "IfNotPresent", |
| 4089 | Version: "v0.8.0", |
| 4090 | }, |
| 4091 | KernelModuleConfig: &gpuv1.KernelModuleConfigSpec{ |
| 4092 | Name: "vgpu-kernel-module-config", |
| 4093 | }, |
| 4094 | }, |
| 4095 | }, |
| 4096 | client: mockClient, |
| 4097 | errorExpected: false, |
| 4098 | }, |
| 4099 | } |
nothing calls this directly
no test coverage detected