Skip to content

Commit 3e182e8

Browse files
author
Antonio Ojea
committed
e2e can't use both pod.Name and pod.GenerateName
This fixes a problem when using the framework helper e2epod.CreateExecPodOrFail() more than once in the same test. The problem is that this function was creating pods with both the pod.Name and pod.GenerateName set. The second pod failed to be created with a 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, xref https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/
1 parent aa1f912 commit 3e182e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/e2e/framework/pod/resource.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,9 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod {
456456

457457
// newExecPodSpec returns the pod spec of exec pod
458458
func newExecPodSpec(ns, generateName string) *v1.Pod {
459-
pod := NewAgnhostPod(ns, "agnhost-pod", nil, nil, nil)
459+
// GenerateName is an optional prefix, used by the server,
460+
// to generate a unique name ONLY IF the Name field has not been provided
461+
pod := NewAgnhostPod(ns, "", nil, nil, nil)
460462
pod.ObjectMeta.GenerateName = generateName
461463
return pod
462464
}

0 commit comments

Comments
 (0)