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

Log command output when the probe result doesn't match expectation #4912

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Apr 27, 2023

The NetworkPolicy e2e tests have been failing randomly for some time. However, it was really hard to get useful information from the "reachability" comparison. This patch logs the probe command's detailed output when the result doesn't match expectation.

Copy link
Contributor

@qiyueyao qiyueyao left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment.

actualResult = Connected
}
if expectedResult != nil && *expectedResult != actualResult {
log.Infof("%s -> %s: expected %s but got %s: err - %v /// stdout - %s /// stderr - %s", podName, dstName, *expectedResult, actualResult, err, stdout, stderr)
Copy link
Contributor

Choose a reason for hiding this comment

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

log.Tracef might be more suitable than log.Infof here, also keeping consistency in this file.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that means we can only see the log when the test itself changes the log level to Trace, which could cause flood of logs generated by the matrix?
The point of the new log is that it only logs the error when it doesn't match the expectation. So if everything works fine, there is no verbose trace logs. If one probe fails, we can find detailed outputs with this probe only.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, makes sense!

Dyanngg
Dyanngg previously approved these changes Apr 27, 2023
Copy link
Contributor

@Dyanngg Dyanngg left a comment

Choose a reason for hiding this comment

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

LGTM, I'll let Quan decide if it's necessary to use log.Tracef

The NetworkPolicy e2e tests have been failing randomly for some time.
However, it was really hard to get useful information from the
"reachability" comparison. This patch logs the probe command's detailed
output when the result doesn't match expectation.

Signed-off-by: Quan Tian <qtian@vmware.com>
Comment on lines -163 to -164
// log this error as trace since may be an expected failure
log.Tracef("%s -> %s: error when running command: err - %v /// stdout - %s /// stderr - %s", podName, dstName, err, stdout, stderr)
Copy link
Member Author

Choose a reason for hiding this comment

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

removed the duplicate log in the latest patch

@tnqn
Copy link
Member Author

tnqn commented Apr 28, 2023

/skip-all

@tnqn tnqn merged commit 7799407 into antrea-io:main Apr 28, 2023
@tnqn tnqn deleted the improve-test-debug branch April 28, 2023 12:53
rajnkamr pushed a commit to rajnkamr/antrea that referenced this pull request May 4, 2023
…ntrea-io#4912)

The NetworkPolicy e2e tests have been failing randomly for some time.
However, it was really hard to get useful information from the
"reachability" comparison. This patch logs the probe command's detailed
output when the result doesn't match expectation.

Signed-off-by: Quan Tian <qtian@vmware.com>
ceclinux pushed a commit to ceclinux/antrea that referenced this pull request Jun 5, 2023
…ntrea-io#4912)

The NetworkPolicy e2e tests have been failing randomly for some time.
However, it was really hard to get useful information from the
"reachability" comparison. This patch logs the probe command's detailed
output when the result doesn't match expectation.

Signed-off-by: Quan Tian <qtian@vmware.com>
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.

3 participants