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 detailed packet structure info output for traceflow test. #5779

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

hangyan
Copy link
Member

@hangyan hangyan commented Dec 8, 2023

improvement for #5760. It's not easy to reproduce the failed case for now, so added more detailed packet structure for the future usage.

@hangyan hangyan changed the title add log [wip] test antrea traceflow flaky test Dec 8, 2023
@hangyan hangyan closed this Dec 20, 2023
@hangyan hangyan reopened this Dec 20, 2023
@hangyan hangyan changed the title [wip] test antrea traceflow flaky test Add detailed packet structure info output for traceflow test. Dec 20, 2023
@@ -23,6 +23,8 @@ import (
"testing"
"time"

"github.com/kr/pretty"
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should be in line 27, there is no need to have a new import section.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

@@ -2557,7 +2559,7 @@ func runTestTraceflow(t *testing.T, data *TestData, tc testcase) {
pktCap.TransportHeader.ICMP = &v1beta1.ICMPEchoRequestHeader{}
}
if !reflect.DeepEqual(tc.expectedPktCap, pktCap) {
t.Fatalf("Captured packet should be: %+v, but got: %+v", tc.expectedPktCap, tf.Status.CapturedPacket)
t.Fatalf("Captured packet should be: %# v, but got: %# v", pretty.Formatter(tc.expectedPktCap), pretty.Formatter(tf.Status.CapturedPacket))
Copy link
Contributor

@luolanzone luolanzone Dec 20, 2023

Choose a reason for hiding this comment

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

I don't get this, looks like it already prints the expected and captured packets before, how would a pretty format logs help here?

Copy link
Member Author

Choose a reason for hiding this comment

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

the origin code will only print the pointer adress of inner-structure in the packet header, make it not easy to compare the actual conent in the header. the new package can print all the nested field in the packet.

@hangyan hangyan requested a review from tnqn December 22, 2023 03:29
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

There are 4 commits for this small change, and none of them has a proper commit title and message. Please squash them and have a formal commit message.

go.mod Outdated
@@ -32,6 +32,7 @@ require (
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.3.0
github.com/k8snetworkplumbingwg/sriov-cni v2.1.0+incompatible
github.com/kevinburke/ssh_config v1.2.0
github.com/kr/pretty v0.3.1
Copy link
Member

Choose a reason for hiding this comment

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

there are plenty of already imported packages can do it, no need to add a new dependency just for this, for example k8s.io/apimachinery/pkg/util/dump

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, will update this. Thank you !

Copy link
Member Author

Choose a reason for hiding this comment

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

@tnqn after some tests, it seems we need to bump the apimachinery packge to at least v0.28+ to have the dump package, and it would require some api changes in antrea code. I would prefer to use the origin solution. or the pacakge apimachinery used itself: "github.com/davecgh/go-spew/spew

@hangyan hangyan force-pushed the topic/yhang/traceflow-flaky-test branch 2 times, most recently from 9f2f105 to 66ad5fd Compare January 2, 2024 08:41
@hangyan hangyan force-pushed the topic/yhang/traceflow-flaky-test branch from 66ad5fd to 3f46d84 Compare January 2, 2024 09:10
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Member

tnqn commented Jan 5, 2024

/skip-all

@tnqn tnqn merged commit fed260a into antrea-io:main Jan 5, 2024
51 of 54 checks passed
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