Skip to content

Commit

Permalink
Fix kubernetes error checking in 2 places
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-at-redhat committed Oct 29, 2024
1 parent 137a7aa commit c3e30c4
Showing 1 changed file with 18 additions and 2 deletions.
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 @@ func (kw *KubeUnit) runWorkUsingTCP() {
connChan := make(chan *net.TCPConn)
go func() {
conn, err := li.Accept()
_ = li.Close()
lcerr := li.Close()
if lcerr != nil {
errMsg := fmt.Error( "Error closing listener: %+v", lcerr )

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / go test coverage

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / go test coverage

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / receptor (Go 1.20)

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / receptor (Go 1.21)

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: fmt.Error

Check failure on line 1024 in pkg/workceptor/kubernetes.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: fmt.Error
kw.UpdateBasicStatus(WorkStateFailed, errMsg, 0)
kw.GetWorkceptor().nc.GetLogger().Error(errMsg) //nolint:govet
cancel()

return
}
if ctx.Err() != nil {
return
}
Expand Down Expand Up @@ -1092,7 +1100,15 @@ func (kw *KubeUnit) runWorkUsingTCP() {
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
}
if err != nil {
errMsg := fmt.Sprintf("Error sending stdin to pod: %s", err)
kw.GetWorkceptor().nc.GetLogger().Error(errMsg) //nolint:govet
Expand Down

0 comments on commit c3e30c4

Please sign in to comment.