pkg/aws,pkg/alibabacloud: replace reflect.DeepEqual in tests
Please ensure your pull request adheres to the following guidelines:
-
For first time contributors, read Submitting a pull request -
All code is covered by unit and/or runtime tests where feasible. -
All commits contain a well written commit description including a title, description and a Fixes: #XXXline if the commit addresses a particular GitHub issue. -
If your commit description contains a Fixes: <commit-id>tag, then please add the commit author[s] as reviewer[s] to this issue. -
All commits are signed off. See the section Developer's Certificate of Origin -
Provide a title or release-note blurb suitable for the release notes. -
Are you a user of Cilium? Please add yourself to the Users doc -
Thanks for contributing!
This PR continues the incremental work to address issue #40562, which aims to replace all uses of reflect.DeepEqual in test code with assert.Equal from the github.com/stretchr/testify/assert package.
Motivation
The problem with reflect.DeepEqual is that when tests fail, it's difficult to discern which specific fields differ between the expected and actual values. Using assert.Equal provides much clearer error messages that show exactly what differs.
Changes
This PR focuses on a small, reviewable scope as suggested in the feedback from PR #40651. It replaces 3 usages of reflect.DeepEqual across two packages:
-
pkg/aws/ec2/ec2_test.go(2 usages) -
pkg/alibabacloud/utils/utils_test.go(1 usage)
Testing
All existing tests continue to pass:
$ go test ./pkg/aws/ec2/... -v
PASS
ok github.com/cilium/cilium/pkg/aws/ec2 0.013s
$ go test ./pkg/alibabacloud/utils/... -v
PASS
ok github.com/cilium/cilium/pkg/alibabacloud/utils 0.004s
Follow-up
This is an incremental change affecting two small packages. Once merged, similar changes can be made to other packages across the codebase.
Previous PRs in this series:
- #42185
- #42186
- #42322
Related: #40562
Testing: Replace reflect.DeepEqual with assert.Equal in pkg/aws and pkg/alibabacloud tests for better error messages