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

Add check for nil timestamp #1187

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Add check for nil timestamp #1187

merged 1 commit into from
Oct 23, 2024

Conversation

AaronH88
Copy link
Contributor

Ref: #1186

Ensure the timestamp returned by K8 api has been correctly parsed.

Copy link

sonarcloud bot commented Oct 23, 2024

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 44.54%. Comparing base (ba214b9) to head (d47c57e).
Report is 1 commits behind head on devel.

Files with missing lines Patch % Lines
pkg/workceptor/kubernetes.go 0.00% 4 Missing ⚠️
@@            Coverage Diff             @@
##            devel    #1187      +/-   ##
==========================================
+ Coverage   44.14%   44.54%   +0.39%     
==========================================
  Files          33       36       +3     
  Lines        8089     8670     +581     
==========================================
+ Hits         3571     3862     +291     
- Misses       4249     4543     +294     
+ Partials      269      265       -4     
Files with missing lines Coverage Δ
pkg/workceptor/kubernetes.go 21.85% <0.00%> (-0.02%) ⬇️

... and 6 files with indirect coverage changes

Components Coverage Δ
Go 44.20% <0.00%> (+0.05%) ⬆️
Receptorctl 49.31% <ø> (∅)

@AaronH88 AaronH88 merged commit 32a3ae7 into ansible:devel Oct 23, 2024
23 of 24 checks passed
TheRealHaoLiu added a commit to TheRealHaoLiu/receptor that referenced this pull request Nov 19, 2024
PR ansible#1187 introduced a situation that causes

```
panic: runtime error: index out of range [1] with length 1

goroutine 534519 [running]:
github.com/ansible/receptor/pkg/workceptor.(*KubeUnit).kubeLoggingWithReconnect(0xc001506b00, 0xc004a97400?, 0xc009cb9fd0?, 0xc00cd1d510, 0xc00cd1d520)
        /Users/haoli/projects/src/github.com/TheRealHaoLiu/receptor/pkg/workceptor/kubernetes.go:395 +0x108b
created by github.com/ansible/receptor/pkg/workceptor.(*KubeUnit).runWorkUsingLogger
        /Users/haoli/projects/src/github.com/TheRealHaoLiu/receptor/pkg/workceptor/kubernetes.go:834 +0xc5e
```

This PR will write the whole line into stdout if first word in the log is not an timestamp

This can both prevent the index out of range error and allow us to record the line in stdout to aid further debugging of this issue.

Co-Authored-By: Matthew Sandoval <[email protected]>
TheRealHaoLiu added a commit to TheRealHaoLiu/receptor that referenced this pull request Nov 19, 2024
PR ansible#1187 introduced a situation that causes

```
panic: runtime error: index out of range [1] with length 1

goroutine 534519 [running]:
github.com/ansible/receptor/pkg/workceptor.(*KubeUnit).kubeLoggingWithReconnect(0xc001506b00, 0xc004a97400?, 0xc009cb9fd0?, 0xc00cd1d510, 0xc00cd1d520)
        /Users/haoli/projects/src/github.com/TheRealHaoLiu/receptor/pkg/workceptor/kubernetes.go:395 +0x108b
created by github.com/ansible/receptor/pkg/workceptor.(*KubeUnit).runWorkUsingLogger
        /Users/haoli/projects/src/github.com/TheRealHaoLiu/receptor/pkg/workceptor/kubernetes.go:834 +0xc5e
```

This PR will write the whole line into stdout if first word in the log is not an timestamp

This can both prevent the index out of range error and allow us to record the line in stdout to aid further debugging of this issue.

Co-Authored-By: Matthew Sandoval <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants