kmesh icon indicating copy to clipboard operation
kmesh copied to clipboard

refactor assert.Equal

Open yp969803 opened this issue 7 months ago • 3 comments

Task description: This is incorrect way of doing

assert.Equal(t, server.xdsClient.WorkloadController.GetMonitoringTrigger(), false)

Solution: correct way

assert.Equal(t, false, assert.Equal(t, server.xdsClient.WorkloadController.GetMonitoringTrigger(), false)

see all the assert.Equal and correct them

Who can join or take the task:

The good first issue is intended for first-time contributors to get started on his/her contributor journey.

After a contributor has successfully completed 1-2 good first issue's, they should be ready to move on to help wanted items, saving the remaining good first issue for other new contributors.

How to join or take the task:

Just reply on the issue with the message /assign in a separate line.

Then, the issue will be assigned to you.

How to ask for help:

If you need help or have questions, please feel free to ask on this issue. The issue author or other members of the community will guide you through the contribution process.

yp969803 avatar Apr 24 '25 14:04 yp969803

/assign

rajat-99 avatar Apr 24 '25 19:04 rajat-99

Hey @yp969803 , may i just know the reasoning behind this? Just curious as newbie

Kaustubh152003 avatar Apr 25 '25 19:04 Kaustubh152003

asser.Equal(actual, expected, msg)

this is the correct way of using assert.Equal, it will give correct logs at the time of error @Kaustubh152003

yp969803 avatar Apr 26 '25 03:04 yp969803

can you give assign me this issue?

codesmith25103 avatar May 07 '25 12:05 codesmith25103

/assign @codesmith25103

yp969803 avatar May 07 '25 16:05 yp969803

@yp969803: GitHub didn't allow me to assign the following users: codesmith.

Note that only kmesh-net members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to this:

/assign codesmith

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

kmesh-bot avatar May 07 '25 16:05 kmesh-bot

@codesmith25103 you can raise a pr for it

yp969803 avatar May 07 '25 16:05 yp969803

asser.Equal(actual, expected, msg)

this is the correct way of using assert.Equal, it will give correct logs at the time of error @Kaustubh152003

Confused by this refactorization. I thought the original one to be right (x).

Flying-Tom avatar May 22 '25 16:05 Flying-Tom

https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions.Equal sorry my bad, you are right

yp969803 avatar May 22 '25 17:05 yp969803