MCPcopy
hub / github.com/kubernetes/kubectl / TestGenerateNodeDebugPodCustomProfile

Function TestGenerateNodeDebugPodCustomProfile

pkg/cmd/debug/debug_test.go:1854–2151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1852}
1853
1854func TestGenerateNodeDebugPodCustomProfile(t *testing.T) {
1855 for _, tc := range []struct {
1856 name string
1857 node *corev1.Node
1858 opts *DebugOptions
1859 expected *corev1.Pod
1860 }{
1861 {
1862 name: "baseline profile",
1863 node: &corev1.Node{
1864 ObjectMeta: metav1.ObjectMeta{
1865 Name: "node-XXX",
1866 },
1867 },
1868 opts: &DebugOptions{
1869 Image: "busybox",
1870 PullPolicy: corev1.PullIfNotPresent,
1871 Profile: ProfileBaseline,
1872 CustomProfile: &corev1.Container{
1873 ImagePullPolicy: corev1.PullNever,
1874 Stdin: true,
1875 TTY: false,
1876 SecurityContext: &corev1.SecurityContext{
1877 Capabilities: &corev1.Capabilities{
1878 Drop: []corev1.Capability{"ALL"},
1879 },
1880 RunAsNonRoot: ptr.To(false),
1881 },
1882 },
1883 },
1884 expected: &corev1.Pod{
1885 ObjectMeta: metav1.ObjectMeta{
1886 Name: "node-debugger-node-XXX-1",
1887 Labels: map[string]string{
1888 "app.kubernetes.io/managed-by": "kubectl-debug",
1889 },
1890 },
1891 Spec: corev1.PodSpec{
1892 Containers: []corev1.Container{
1893 {
1894 Name: "debugger",
1895 Image: "busybox",
1896 ImagePullPolicy: corev1.PullNever,
1897 TerminationMessagePolicy: corev1.TerminationMessageReadFile,
1898 VolumeMounts: nil,
1899 Stdin: true,
1900 TTY: false,
1901 SecurityContext: &corev1.SecurityContext{
1902 RunAsNonRoot: ptr.To(false),
1903 Capabilities: &corev1.Capabilities{
1904 Drop: []corev1.Capability{"ALL"},
1905 },
1906 },
1907 },
1908 },
1909 HostIPC: false,
1910 HostNetwork: false,
1911 HostPID: false,

Callers

nothing calls this directly

Calls 6

NewProfileApplierFunction · 0.85
ToMethod · 0.80
generateNodeDebugPodMethod · 0.80
DiffMethod · 0.80
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…