Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't "Follow" when dumping test pod logs. #3447

Merged
merged 1 commit into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/build_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ func getContainersLogsFromPod(ctx context.Context, c kubernetes.Interface, pod,

func getContainerLogsFromPod(ctx context.Context, c kubernetes.Interface, pod, container, namespace string) (string, error) {
sb := strings.Builder{}
req := c.CoreV1().Pods(namespace).GetLogs(pod, &corev1.PodLogOptions{Follow: true, Container: container})
// Do not follow, which will block until the Pod terminates, and potentially deadlock the test.
// If done in the wrong order, this could actually block things and prevent the Pod from being
// deleted at all.
req := c.CoreV1().Pods(namespace).GetLogs(pod, &corev1.PodLogOptions{Follow: false, Container: container})
rc, err := req.Stream(ctx)
if err != nil {
return "", err
Expand Down
5 changes: 4 additions & 1 deletion test/v1alpha1/build_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ func getContainersLogsFromPod(ctx context.Context, c kubernetes.Interface, pod,

func getContainerLogsFromPod(ctx context.Context, c kubernetes.Interface, pod, container, namespace string) (string, error) {
sb := strings.Builder{}
req := c.CoreV1().Pods(namespace).GetLogs(pod, &corev1.PodLogOptions{Follow: true, Container: container})
// Do not follow, which will block until the Pod terminates, and potentially deadlock the test.
// If done in the wrong order, this could actually block things and prevent the Pod from being
// deleted at all.
req := c.CoreV1().Pods(namespace).GetLogs(pod, &corev1.PodLogOptions{Follow: false, Container: container})
rc, err := req.Stream(ctx)
if err != nil {
return "", err
Expand Down