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

Fix kubernetes error checking in 2 places #1200

Merged
Merged
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
20 changes: 18 additions & 2 deletions pkg/workceptor/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,15 @@
connChan := make(chan *net.TCPConn)
go func() {
conn, err := li.Accept()
_ = li.Close()
lcerr := li.Close()
if lcerr != nil {
errMsg := fmt.Sprintf("Error closing listener: %+v", lcerr)
kw.UpdateBasicStatus(WorkStateFailed, errMsg, 0)
kw.GetWorkceptor().nc.GetLogger().Error(errMsg) //nolint:govet
cancel()

return
}

Check warning on line 1030 in pkg/workceptor/kubernetes.go

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/kubernetes.go#L1022-L1030

Added lines #L1022 - L1030 were not covered by tests
if ctx.Err() != nil {
return
}
Expand Down Expand Up @@ -1092,7 +1100,15 @@
if ctx.Err() != nil {
return
}
_ = conn.CloseWrite()
cwerr := conn.CloseWrite()
if cwerr != nil {
errMsg := fmt.Sprintf("Error closing writing side: %+v", cwerr)
kw.GetWorkceptor().nc.GetLogger().Error(errMsg) //nolint:govet
kw.UpdateBasicStatus(WorkStateFailed, errMsg, 0)
cancel()

return
}

Check warning on line 1111 in pkg/workceptor/kubernetes.go

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/kubernetes.go#L1103-L1111

Added lines #L1103 - L1111 were not covered by tests
if err != nil {
errMsg := fmt.Sprintf("Error sending stdin to pod: %s", err)
kw.GetWorkceptor().nc.GetLogger().Error(errMsg) //nolint:govet
Expand Down