-
Notifications
You must be signed in to change notification settings - Fork 366
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
Conversation
test/e2e/traceflow_test.go
Outdated
@@ -23,6 +23,8 @@ import ( | |||
"testing" | |||
"time" | |||
|
|||
"github.com/kr/pretty" |
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.
This line should be in line 27, there is no need to have a new import section.
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.
Ok
test/e2e/traceflow_test.go
Outdated
@@ -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)) |
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 don't get this, looks like it already prints the expected and captured packets before, how would a pretty format logs help here?
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.
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.
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.
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 |
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.
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
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.
OK, will update this. Thank you !
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.
@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
9f2f105
to
66ad5fd
Compare
Signed-off-by: Hang Yan <[email protected]>
66ad5fd
to
3f46d84
Compare
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.
LGTM
/skip-all |
improvement for #5760. It's not easy to reproduce the failed case for now, so added more detailed packet structure for the future usage.