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 missing last line when kube err #1216

Merged
merged 3 commits into from
Dec 4, 2024
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
9 changes: 9 additions & 0 deletions pkg/workceptor/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,17 @@
// At this point we exausted all retries, every retry we either failed to read OR we read but did not get newer msg
// If we got a EOF on the last retry we assume that we read everything and we can stop the loop
// we ASSUME this is the happy path.
// If kube api returned an error there is a missing new line and that line never gets read.

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

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/kubernetes.go#L380

Added line #L380 was not covered by tests
if err != io.EOF {
*stdoutErr = err
} else if line != "" && err == io.EOF {
_, err = stdout.Write([]byte(line + "\n"))
if err != nil {
*stdoutErr = fmt.Errorf("writing to stdout: %s", err)
kw.GetWorkceptor().nc.GetLogger().Error("Error writing to stdout: %s", err)

return
}

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

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/kubernetes.go#L383-L390

Added lines #L383 - L390 were not covered by tests
}

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/workceptor/workunitbase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func TestBaseStatus(t *testing.T) {
func TestBaseRelease(t *testing.T) {
ctrl, bwu, w, _, _ := setUp(t)
mockFileSystem := mock_workceptor.NewMockFileSystemer(ctrl)
bwu.Init(w, "test", "", mockFileSystem, &workceptor.RealWatcher{})
bwu.Init(w, "test12345", "", mockFileSystem, &workceptor.RealWatcher{})

const removeError = "RemoveAll Error"
testCases := []struct {
Expand Down
Loading