MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / TestTransformDriverVGPUTopologyConfig

Function TestTransformDriverVGPUTopologyConfig

controllers/transforms_test.go:3840–3920  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3838}
3839
3840func TestTransformDriverVGPUTopologyConfig(t *testing.T) {
3841 node := &corev1.Node{
3842 ObjectMeta: metav1.ObjectMeta{
3843 Name: "test-node",
3844 Labels: map[string]string{
3845 nfdOSReleaseIDLabelKey: "ubuntu",
3846 nfdOSVersionIDLabelKey: "20.04",
3847 nfdKernelLabelKey: "6.8.0-60-generic",
3848 commonGPULabelKey: "true",
3849 },
3850 },
3851 }
3852 mockClient := fake.NewFakeClient(node)
3853 ds := NewDaemonset().WithContainer(corev1.Container{Name: "nvidia-driver-ctr"}).
3854 WithInitContainer(corev1.Container{Name: "k8s-driver-manager"})
3855 cpSpec := &gpuv1.ClusterPolicySpec{
3856 Driver: gpuv1.DriverSpec{
3857 Repository: "nvcr.io/nvidia",
3858 Image: "driver",
3859 Version: "570.172.08",
3860 Manager: gpuv1.DriverManagerSpec{
3861 Repository: "nvcr.io/nvidia/cloud-native",
3862 Image: "k8s-driver-manager",
3863 Version: "v0.8.0",
3864 },
3865 VirtualTopology: &gpuv1.VirtualTopologyConfigSpec{
3866 Config: "sample-topology-config",
3867 },
3868 },
3869 }
3870
3871 expectedDs := NewDaemonset().WithContainer(corev1.Container{
3872 Name: "nvidia-driver-ctr",
3873 Image: "nvcr.io/nvidia/driver:570.172.08-ubuntu20.04",
3874 ImagePullPolicy: corev1.PullIfNotPresent,
3875 VolumeMounts: []corev1.VolumeMount{
3876 {
3877 Name: "topology-config",
3878 ReadOnly: true,
3879 MountPath: consts.VGPUTopologyConfigMountPath,
3880 SubPath: consts.VGPUTopologyConfigFileName,
3881 },
3882 },
3883 Env: []corev1.EnvVar{
3884 {
3885 Name: "DRIVER_CONFIG_DIGEST",
3886 Value: "1340033241",
3887 },
3888 },
3889 }).WithInitContainer(corev1.Container{
3890 Name: "k8s-driver-manager",
3891 Image: "nvcr.io/nvidia/cloud-native/k8s-driver-manager:v0.8.0",
3892 Env: []corev1.EnvVar{
3893 {
3894 Name: "DRIVER_CONFIG_DIGEST",
3895 Value: "1340033241",
3896 },
3897 },

Callers

nothing calls this directly

Calls 6

NewDaemonsetFunction · 0.85
TransformDriverFunction · 0.85
WithContainerMethod · 0.80
WithVolumeMethod · 0.80
WithNameMethod · 0.80
WithInitContainerMethod · 0.45

Tested by

no test coverage detected