(t *testing.T)
| 1642 | } |
| 1643 | |
| 1644 | func TestRuntimeClasses(t *testing.T) { |
| 1645 | const ( |
| 1646 | testNamespace = "test-namespace" |
| 1647 | ) |
| 1648 | |
| 1649 | // Create scheme with required types |
| 1650 | scheme := runtime.NewScheme() |
| 1651 | require.NoError(t, nodev1.AddToScheme(scheme)) |
| 1652 | require.NoError(t, nodev1beta1.AddToScheme(scheme)) |
| 1653 | require.NoError(t, apiextensionsv1.AddToScheme(scheme)) |
| 1654 | require.NoError(t, gpuv1.AddToScheme(scheme)) |
| 1655 | |
| 1656 | // Create controller with given spec and state |
| 1657 | newController := func(k8s client.Client, scheme *runtime.Scheme, spec gpuv1.ClusterPolicySpec, state string) ClusterPolicyController { |
| 1658 | clusterPolicy := &gpuv1.ClusterPolicy{Spec: spec} |
| 1659 | resources := []Resources{ |
| 1660 | { |
| 1661 | RuntimeClasses: []nodev1.RuntimeClass{ |
| 1662 | { |
| 1663 | ObjectMeta: metav1.ObjectMeta{ |
| 1664 | Name: "nvidia", |
| 1665 | }, |
| 1666 | TypeMeta: metav1.TypeMeta{ |
| 1667 | Kind: "RuntimeClass", |
| 1668 | APIVersion: "node.k8s.io/v1", |
| 1669 | }, |
| 1670 | }, |
| 1671 | { |
| 1672 | ObjectMeta: metav1.ObjectMeta{ |
| 1673 | Name: "nvidia-cdi", |
| 1674 | }, |
| 1675 | TypeMeta: metav1.TypeMeta{ |
| 1676 | Kind: "RuntimeClass", |
| 1677 | APIVersion: "node.k8s.io/v1", |
| 1678 | }, |
| 1679 | }, |
| 1680 | { |
| 1681 | ObjectMeta: metav1.ObjectMeta{ |
| 1682 | Name: "nvidia-legacy", |
| 1683 | }, |
| 1684 | TypeMeta: metav1.TypeMeta{ |
| 1685 | Kind: "RuntimeClass", |
| 1686 | APIVersion: "node.k8s.io/v1", |
| 1687 | }, |
| 1688 | }, |
| 1689 | }, |
| 1690 | }, |
| 1691 | } |
| 1692 | |
| 1693 | return ClusterPolicyController{ |
| 1694 | client: k8s, |
| 1695 | ctx: context.Background(), |
| 1696 | singleton: clusterPolicy, |
| 1697 | scheme: scheme, |
| 1698 | operatorNamespace: testNamespace, |
| 1699 | resources: resources, |
| 1700 | stateNames: []string{state}, |
| 1701 | idx: 0, |
nothing calls this directly
no test coverage detected