-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fail test if the expected and actual traces differ (#777) #781
Fail test if the expected and actual traces differ (#777) #781
Conversation
} | ||
|
||
diff := pretty.Diff(expected, actual) | ||
if len(diff) > 0 { |
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.
nit: combine into one line: if diff := pretty.Diff(expected, actual); len(diff) > 0 {
|
||
diff := pretty.Diff(expected, actual) | ||
if len(diff) > 0 { | ||
t.Logf("Expected and actual differ: %v\n", diff) |
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.
when there are many differences, this doesn't print them in easily readable way. I prefer the loop as before.
6cac6a7
to
008eec8
Compare
Use pretty.Diff(expected, actual) instead of reflect.DeepEqual(expected, actual) to check for equality between given and received trace. Also, if there is a difference, set the test to fail instead of only logging the failed trace. Signed-off-by: Michael Burman <miburman@redhat.com>
008eec8
to
455a85d
Compare
Yep, modified based on the review. |
looks like the builds are failing due to #786 |
|
||
if diff := pretty.Diff(expected, actual); len(diff) > 0 { | ||
for _, d := range diff { | ||
t.Logf("Expected and actual differ: %v\n", d) |
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.
nit: \n
is not necessary, but ok
thanks @burmanm ! |
Use pretty.Diff(expected, actual) instead of reflect.DeepEqual(expected, actual) to check for equality between given and received trace. Also, if there is a difference, set the test to fail instead of only logging the failed trace.
And prettify the storage-integration-test output