Copilot commented on code in PR #839:
URL:
https://github.com/apache/skywalking-banyandb/pull/839#discussion_r2498904625
##########
banyand/measure/topn_test.go:
##########
@@ -82,10 +100,11 @@ func TestTopNValue_MarshalUnmarshal(t *testing.T) {
require.NoError(t, err)
// Compare the original and decoded topNValue
- require.Equal(t, tt.topNVal.valueName,
tt.topNVal.valueName)
- require.Equal(t, tt.topNVal.entityTagNames,
tt.topNVal.entityTagNames)
- require.Equal(t, tt.topNVal.values, tt.topNVal.values)
- require.Equal(t, tt.topNVal.entities,
tt.topNVal.entities)
+ require.Equal(t, originalValueName,
tt.topNVal.valueName)
+ require.Equal(t, originalEntityTagNames,
tt.topNVal.entityTagNames)
+ require.Equal(t, originalValues, tt.topNVal.values)
+ require.Empty(t, cmp.Diff(originalEntities,
tt.topNVal.entities, protocmp.Transform()))
Review Comment:
[nitpick] Consider using `require.Equal(t, originalEntities,
tt.topNVal.entities, protocmp.Transform())` instead of checking for an empty
diff. This provides more consistent API usage with the other assertions and
clearer failure messages showing what values differ, rather than showing the
diff output.
```suggestion
require.True(t, cmp.Equal(originalEntities,
tt.topNVal.entities, protocmp.Transform()), "entities differ: %s",
cmp.Diff(originalEntities, tt.topNVal.entities, protocmp.Transform()))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]