(t *testing.T)
| 674 | } |
| 675 | |
| 676 | func TestApplyCommonDaemonSetConfig(t *testing.T) { |
| 677 | testCases := []struct { |
| 678 | description string |
| 679 | ds Daemonset |
| 680 | dsSpec gpuv1.DaemonsetsSpec |
| 681 | errorExpected bool |
| 682 | expectedDs Daemonset |
| 683 | }{ |
| 684 | { |
| 685 | description: "empty daemonset spec configuration", |
| 686 | ds: NewDaemonset(), |
| 687 | dsSpec: gpuv1.DaemonsetsSpec{}, |
| 688 | expectedDs: NewDaemonset(), |
| 689 | }, |
| 690 | { |
| 691 | description: "priorityclass configured", |
| 692 | ds: NewDaemonset(), |
| 693 | dsSpec: gpuv1.DaemonsetsSpec{PriorityClassName: "test-priority-class"}, |
| 694 | expectedDs: NewDaemonset().WithPriorityClass("test-priority-class"), |
| 695 | }, |
| 696 | { |
| 697 | description: "toleration configured", |
| 698 | ds: NewDaemonset(), |
| 699 | dsSpec: gpuv1.DaemonsetsSpec{ |
| 700 | Tolerations: []corev1.Toleration{ |
| 701 | { |
| 702 | Key: "test-key", |
| 703 | Operator: corev1.TolerationOpExists, |
| 704 | Effect: corev1.TaintEffectNoSchedule, |
| 705 | }, |
| 706 | }, |
| 707 | }, |
| 708 | expectedDs: NewDaemonset().WithTolerations([]corev1.Toleration{ |
| 709 | { |
| 710 | Key: "test-key", |
| 711 | Operator: corev1.TolerationOpExists, |
| 712 | Effect: corev1.TaintEffectNoSchedule, |
| 713 | }, |
| 714 | }), |
| 715 | }, |
| 716 | { |
| 717 | description: "invalid updatestrategy configured", |
| 718 | ds: NewDaemonset(), |
| 719 | dsSpec: gpuv1.DaemonsetsSpec{ |
| 720 | UpdateStrategy: "RollingUpdate", |
| 721 | RollingUpdate: &gpuv1.RollingUpdateSpec{ |
| 722 | MaxUnavailable: "10%abc", |
| 723 | }}, |
| 724 | errorExpected: true, |
| 725 | }, |
| 726 | { |
| 727 | description: "podSecurityContext configured", |
| 728 | ds: NewDaemonset(), |
| 729 | dsSpec: gpuv1.DaemonsetsSpec{ |
| 730 | PodSecurityContext: &corev1.PodSecurityContext{ |
| 731 | RunAsUser: ptr.To(int64(1000)), |
| 732 | RunAsGroup: ptr.To(int64(3000)), |
| 733 | FSGroup: ptr.To(int64(2000)), |
nothing calls this directly
no test coverage detected