-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Retain process logs on robustness tests #16077
base: main
Are you sure you want to change the base?
Conversation
ca95eef
to
b599235
Compare
Etcd logs are available the same way as e2e logs. By passing |
If you feel like browsing the logs is convenient enough already I'm happy to close. For me it makes more sense to have the member debug logs next to the history.html in the artifacts zip. |
It's not #15079 |
FYI main challenge here is to merge logs from between server restarts. |
9359aa9
to
ab50d80
Compare
@serathius created an aggregation of LogExpects to merge the logs. Let me know if the implemented behavior works for you, too (mostly on the expect side of things). |
tests/framework/e2e/etcd_process.go
Outdated
@@ -230,7 +233,7 @@ func (ep *EtcdServerProcess) Config() *EtcdServerProcessConfig { return ep.cfg } | |||
|
|||
func (ep *EtcdServerProcess) Logs() LogsExpect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks nice, but changing func (ep *EtcdServerProcess) Logs() LogsExpect
semantic behavior is risky. When I expect most people will assume member.Logs().ExpectWithContext()
will analyse logs emitted from the current run and might stumble on problem that log they are expecting was already emitted before restart.
Proposal:
- Have
func (ep *EtcdServerProcess) Logs() LogsExpect
return logsExpect from the latest runep.logs.procLogs[len(ep.logs.procLogs)-1]
- Have a separate method like
allLogLines
oraggregatedLogLines
etcd that will return appended results of all runs.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with the incremental changes to be safe.
func (ep *EtcdServerProcess) Logs() LogsExpect
was using ep.proc
in happy case and most of the cases.
The PR is intended to retain all the previous runs logs after all the runs of the process are stopped.
Seems only func (m *multiLogsExpect) Lines()
is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have func (ep *EtcdServerProcess) Logs() LogsExpect return logsExpect from the latest run ep.logs.procLogs[len(ep.logs.procLogs)-1]
Sounds like a good proposal to me. Is that also acceptable for you @chaochn47?
Seems only func (m *multiLogsExpect) Lines() is needed.
Currently yes, I'm surprised we don't have expect tests across stop/restart scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a slight alternative as a new commit, while the process is running it will return the running LogsExpect
, otherwise the last one from the multiLogsExpect
.
Looking into the dependencies of the Lines
method we could also split the interface in two, one for the Lines+Count and one for the expect to leave the current code paths untouched. There's only a zap test depending on the lines of a given process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently yes, I'm surprised we don't have expect tests across stop/restart scenarios.
We want to explicitly avoid that because it not natural. Imagine that you want to check that etcd member has started using one of the starting logs. It's natural to call member.Logs().Expect("etcd started")
, but it needs to only consider the logs from the last restart to make sense. Otherwise it might always return true when member was already restarted.
tldr. Don't want to change the semantics of func (ep *EtcdServerProcess) Logs() LogsExpect
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, pushed another by just moving up the Lines and Count via interface, so the current LogsExpect stays entirely untouched.
Adding a set of functions which retain e2e etcd process logs after stop and saving next to the visualized model during robustness tests. Spun out of etcd-io#16018 where I used it for easier local debugging on model violations. Fixes etcd-io#15079 partially. Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
4d2a097
to
b5cdfc0
Compare
return ep.logs.Lines() | ||
} | ||
|
||
func (ep *EtcdServerProcess) LineCount() int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't looks like it's used by anyone. Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just two places ultimately: https://github.com/search?q=repo%3Aetcd-io%2Fetcd%20LineCount&type=code
but looks like it could be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's not needed for EtcdServerProcess.
@@ -235,6 +242,14 @@ func (ep *EtcdServerProcess) Logs() LogsExpect { | |||
return ep.proc | |||
} | |||
|
|||
func (ep *EtcdServerProcess) Lines() []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed interface member.Logs()
and member.Lines()
seems unnatural. Recommendation:
- Rename
member.Logs()
tomember.ProcessLogs()
to inform that those logs come only from the started process. - Rename
member.Lines()
tomember.DumpLogs()
.
@@ -72,6 +77,7 @@ type EtcdServerProcess struct { | |||
proxy proxy.Server | |||
failpoints *BinaryFailpoints | |||
donec chan struct{} // closed when Interact() terminates | |||
logs *procLogs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logs *procLogs | |
logs procLogs |
It doesn't need to be a pointer.
@@ -235,6 +242,14 @@ func (ep *EtcdServerProcess) Logs() LogsExpect { | |||
return ep.proc | |||
} | |||
|
|||
func (ep *EtcdServerProcess) Lines() []string { | |||
return ep.logs.Lines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it pretty unnatural that calling member.Lines()
will not return me any log lines until the process has exited.
@@ -378,3 +393,20 @@ func GetVersionFromBinary(binaryPath string) (*semver.Version, error) { | |||
|
|||
return nil, fmt.Errorf("could not find version in binary output of %s, lines outputted were %v", binaryPath, lines) | |||
} | |||
|
|||
type procLogs struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think the name makes sense. Does "proc" refer to process or something else? As this merges log lines from multiple process lines it's definitely not processLogs.
@@ -378,3 +393,20 @@ func GetVersionFromBinary(binaryPath string) (*semver.Version, error) { | |||
|
|||
return nil, fmt.Errorf("could not find version in binary output of %s, lines outputted were %v", binaryPath, lines) | |||
} | |||
|
|||
type procLogs struct { | |||
procLogs []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know you don't need to create struct just have type logs []string
?
Also, please remove environment EXPECT_DEBUG from the Robustness tests github workflow. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
@tjungblu: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Adding a new flag to retain e2e etcd process logs after stop and saving next to the visualized model.
Spun out of #16018 where I used it for easier local debugging on model violations.
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.