Merge pull request #82335 from rphillips/fixes/e2e_crash

kubelet e2e: defer the close to after the error check
This commit is contained in:
Kubernetes Prow Robot 2019-09-05 11:30:43 -07:00 committed by GitHub
commit 2e6b073a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,10 +168,10 @@ var _ = framework.KubeDescribe("Kubelet", func() {
gomega.Eventually(func() error {
rc, err := podClient.GetLogs(podName, &v1.PodLogOptions{}).Stream()
defer rc.Close()
if err != nil {
return err
}
defer rc.Close()
buf := new(bytes.Buffer)
buf.ReadFrom(rc)
hostsFileContent := buf.String()