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

Function TestGenerateCopyDebugPodCustomProfile

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

Source from the content-addressed store, hash-verified

2151}
2152
2153func TestGenerateCopyDebugPodCustomProfile(t *testing.T) {
2154 for _, tc := range []struct {
2155 name string
2156 copyPod *corev1.Pod
2157 opts *DebugOptions
2158 expected *corev1.Pod
2159 }{
2160 {
2161 name: "baseline profile",
2162 copyPod: &corev1.Pod{
2163 Spec: corev1.PodSpec{
2164 ServiceAccountName: "test",
2165 NodeName: "test-node",
2166 },
2167 },
2168 opts: &DebugOptions{
2169 SameNode: true,
2170 Image: "busybox",
2171 PullPolicy: corev1.PullIfNotPresent,
2172 Profile: ProfileBaseline,
2173 CustomProfile: &corev1.Container{
2174 ImagePullPolicy: corev1.PullNever,
2175 Stdin: true,
2176 TTY: false,
2177 SecurityContext: &corev1.SecurityContext{
2178 Capabilities: &corev1.Capabilities{
2179 Drop: []corev1.Capability{"ALL"},
2180 },
2181 RunAsNonRoot: ptr.To(false),
2182 },
2183 },
2184 },
2185 expected: &corev1.Pod{
2186 Spec: corev1.PodSpec{
2187 ServiceAccountName: "test",
2188 NodeName: "test-node",
2189 Containers: []corev1.Container{
2190 {
2191 Image: "busybox",
2192 ImagePullPolicy: corev1.PullNever,
2193 TerminationMessagePolicy: corev1.TerminationMessageReadFile,
2194 VolumeMounts: nil,
2195 Stdin: true,
2196 TTY: false,
2197 SecurityContext: &corev1.SecurityContext{
2198 RunAsNonRoot: ptr.To(false),
2199 Capabilities: &corev1.Capabilities{
2200 Drop: []corev1.Capability{"ALL"},
2201 },
2202 },
2203 },
2204 },
2205 HostIPC: false,
2206 HostNetwork: false,
2207 HostPID: false,
2208 Volumes: nil,
2209 ShareProcessNamespace: ptr.To(true),
2210 },

Callers

nothing calls this directly

Calls 6

NewProfileApplierFunction · 0.85
ToMethod · 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…