(t *testing.T)
| 2883 | } |
| 2884 | |
| 2885 | func TestTransformSandboxValidator(t *testing.T) { |
| 2886 | testCases := []struct { |
| 2887 | description string |
| 2888 | ds Daemonset |
| 2889 | cpSpec *gpuv1.ClusterPolicySpec |
| 2890 | expectedDs Daemonset |
| 2891 | errorExpected bool |
| 2892 | }{ |
| 2893 | { |
| 2894 | description: "empty validator spec", |
| 2895 | ds: NewDaemonset(). |
| 2896 | WithInitContainer(corev1.Container{Name: "dummy"}). |
| 2897 | WithContainer(corev1.Container{Name: "dummy"}), |
| 2898 | cpSpec: &gpuv1.ClusterPolicySpec{ |
| 2899 | Validator: gpuv1.ValidatorSpec{}, |
| 2900 | }, |
| 2901 | expectedDs: NewDaemonset(), |
| 2902 | errorExpected: true, |
| 2903 | }, |
| 2904 | { |
| 2905 | description: "valid validator spec", |
| 2906 | ds: NewDaemonset(). |
| 2907 | WithInitContainer(corev1.Container{Name: "dummy"}). |
| 2908 | WithContainer(corev1.Container{ |
| 2909 | Name: "dummy", |
| 2910 | Image: "nvcr.io/nvidia/cloud-native/gpu-operator-validator:v1.0.0", |
| 2911 | ImagePullPolicy: corev1.PullIfNotPresent, |
| 2912 | SecurityContext: &corev1.SecurityContext{ |
| 2913 | RunAsUser: rootUID, |
| 2914 | }, |
| 2915 | }). |
| 2916 | WithPullSecret("pull-secret"). |
| 2917 | WithRuntimeClassName("nvidia"), |
| 2918 | cpSpec: &gpuv1.ClusterPolicySpec{ |
| 2919 | Validator: gpuv1.ValidatorSpec{ |
| 2920 | Repository: "nvcr.io/nvidia/cloud-native", |
| 2921 | Image: "gpu-operator-validator", |
| 2922 | Version: "v1.0.0", |
| 2923 | ImagePullPolicy: "IfNotPresent", |
| 2924 | ImagePullSecrets: []string{"pull-secret"}, |
| 2925 | }, |
| 2926 | }, |
| 2927 | expectedDs: NewDaemonset(). |
| 2928 | WithInitContainer(corev1.Container{Name: "dummy"}). |
| 2929 | WithContainer(corev1.Container{ |
| 2930 | Name: "dummy", |
| 2931 | Image: "nvcr.io/nvidia/cloud-native/gpu-operator-validator:v1.0.0", |
| 2932 | ImagePullPolicy: corev1.PullIfNotPresent, |
| 2933 | SecurityContext: &corev1.SecurityContext{ |
| 2934 | RunAsUser: rootUID, |
| 2935 | }, |
| 2936 | }). |
| 2937 | WithPullSecret("pull-secret"). |
| 2938 | WithRuntimeClassName("nvidia"), |
| 2939 | }, |
| 2940 | } |
| 2941 | |
| 2942 | for _, tc := range testCases { |
nothing calls this directly
no test coverage detected