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

e2e: ExecCmd debug log on error #1924

Merged
merged 3 commits into from
Jul 1, 2022
Merged

e2e: ExecCmd debug log on error #1924

merged 3 commits into from
Jul 1, 2022

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Jun 30, 2022

Closes: #XXX

What is the purpose of the change

This change was originally introduced in #1898. However, in #1898 if "error" was found, the system would fail on the following line:

That started causing issues because some applications such as Hermes log "error" to stderr in the normal mode of operation. So the change was reverted in #1902

This log proved to be incredibly helpful, making me manually change every PR for debugging. So, a modified version is introduced here. This version does not fail but only logs when "error is encountered.

Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? no
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? not applicable

@p0mvn p0mvn marked this pull request as ready for review June 30, 2022 23:12
@p0mvn p0mvn requested a review from a team June 30, 2022 23:12
@czarcas7ic
Copy link
Member

Can you give an example where this would be useful? I am just lacking context, since as it stands when an error occurs it eventually halts the e2e test suite and prints the error to the terminal right?

@p0mvn
Copy link
Member Author

p0mvn commented Jun 30, 2022

eventually halts the e2e test suite and prints the error to the terminal right

It does not print anything.

The arguments are evaluated before running the callback so it prints empty. In fact, we should remove this line because it always prints empty in place of errBuf and outBuf:

"tx returned a non-zero code; stdout: %s, stderr: %s", outBuf.String(), errBuf.String()
        // 1. We start here with empty errBuf 
	require.Eventually(
		t,
		func() bool {
	                      // 3. We update errBug here (after it was evaluated in 2.)
		},
		time.Minute,
		time.Second,
		"tx returned a non-zero code; stdout: %s, stderr: %s", outBuf.String(), errBuf.String(),  // 2. This gets evaluated so this is always empty
	)

@p0mvn
Copy link
Member Author

p0mvn commented Jun 30, 2022

I made some updates, let me know what you think.

This change also allows us to see if there is an error right away as opposed to waiting for 1 minute to get a log without stdout or stderr

Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now!

@p0mvn p0mvn merged commit 5ba829f into main Jul 1, 2022
@p0mvn p0mvn deleted the roman/e2e-debug-log branch July 1, 2022 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants