cluster-api-provider-aws icon indicating copy to clipboard operation
cluster-api-provider-aws copied to clipboard

Improve testcase naming convention

Open Madhur97 opened this issue 3 years ago • 27 comments

/area testing

We have started following test naming convention for new test cases in CAPA, we can also do this for existing test cases to bring consistency.

We use this blog for reference. Sample PRs: https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3160 https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3091

/good-first-issue

Madhur97 avatar Feb 11 '22 08:02 Madhur97

@Madhur97: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/area testing

We have started following test naming convention for new test cases in CAPA, we can also do this for existing test cases to bring consistency.

We use this blog for reference. Sample PRs: https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3160 https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3091

/good-first-issue

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.

k8s-ci-robot avatar Feb 11 '22 08:02 k8s-ci-robot

@Madhur97: This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

k8s-ci-robot avatar Feb 11 '22 08:02 k8s-ci-robot

Have you considered the following, property-based convention, which is even easier to read and more informative? https://youtu.be/tWn8RA_DEic?t=3069

invidian avatar Feb 16 '22 10:02 invidian

Is this PR up for grab?? @Madhur97 @Ankitasw

VibhorChinda avatar Feb 22 '22 12:02 VibhorChinda

Hey @VibhorChinda, sure let me assign it to you. /assign @VibhorChinda

Ankitasw avatar Feb 22 '22 12:02 Ankitasw

@Ankitasw thanks for assigning it to me :)

@Ankitasw @Madhur97 I was looking at the PR mentioned in the description for reference. I saw that the naming convention used is like "TestService_ServiceName" like "TestService_Delete". This naming convention has to be followed everywhere or I am heading in the wrong direction ?

And could you please point out to the directories I need to look for tests and change the test names using the convention. Thanks :)

VibhorChinda avatar Feb 22 '22 15:02 VibhorChinda

Any Updates here ? @Madhur97 @Ankitasw

VibhorChinda avatar Feb 26 '22 18:02 VibhorChinda

Hey @VibhorChinda sorry for delayed response. The naming convention you mentioned above is for functions. What we are trying to achieve here is each test case names should follow a naming convention. Till now, we have followed naming convention like this: Should_ExpectedBehavior_When_StateUnderTest as mentioned in the reference blog here.

Ankitasw avatar Mar 08 '22 10:03 Ankitasw

Understood your point @Ankitasw. But there will be so many tests in whole codebase right. Should one PR be pointing towards all tests or should this PR contain child PRs targeting specific folders and files.

I am confused with the locations I need to make changes

VibhorChinda avatar Mar 08 '22 14:03 VibhorChinda

This PR's scope is to make changes for all the test files. To ease it out, maybe you can start with one package in the code per PR. Wdyt?

Ankitasw avatar Mar 08 '22 14:03 Ankitasw

cool will try one package in the code per PR.

VibhorChinda avatar Mar 08 '22 15:03 VibhorChinda

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 06 '22 16:06 k8s-triage-robot

Any updates?

/remove-lifecycle stale

sedefsavas avatar Jun 06 '22 16:06 sedefsavas

Hey @sedefsavas no updates as such. Sorry for blocking this issue for so long.

Unassigning myself, so that anyone with some bandwidth can take this up.

VibhorChinda avatar Jun 20 '22 10:06 VibhorChinda

/assign

tasdikrahman avatar Aug 11 '22 22:08 tasdikrahman

Hello there, I have tried opening a small PR https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3667 to refactor the specs for the cloud/service/network package, please have a look and let me know if that the way in which we would like the changes to go forward for the other packages too.

tasdikrahman avatar Aug 12 '22 16:08 tasdikrahman

Sticking with the camel case test naming convention is another option here. Core Cluster API is following that and few other providers as well. If there are places we don’t follow that convention we can fix those. I don't see a major readability benefit of the new convention but don't have a strong opinion, it is just another convention.

sedefsavas avatar Aug 15 '22 17:08 sedefsavas

Thanks for the help, I updated the PR to reflect the test names having camel case, please have a look if that's how I would proceed for the other packages. https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3667

tasdikrahman avatar Aug 15 '22 20:08 tasdikrahman

I think we deviated from what was expected here. We were talking about the testcase naming conventions, not function naming convention. As mentioned in the description of the issue, we would use any of the naming convention listed here and would be consistent around whole repo.

Ankitasw avatar Aug 16 '22 10:08 Ankitasw

Hi @Ankitasw, is this issue still open? If so, I'd like to work on it.

harshitasao avatar Sep 15 '22 17:09 harshitasao

apologies for being inactive on the PR, please feel free to pick this issue up again.

tasdikrahman avatar Oct 19 '22 20:10 tasdikrahman

/triage accepted /priority backlog

dlipovetsky avatar Dec 12 '22 17:12 dlipovetsky

I would like to work on this /assign

fazpeerbaksh avatar Jan 06 '23 12:01 fazpeerbaksh

Hi @Ankitasw @sedefsavas , I have raised a PR to fix all the test cases naming to camel case, could you please have a look #3966

fazpeerbaksh avatar Jan 07 '23 22:01 fazpeerbaksh

I think this issue is solved now right?

Sajiyah-Salat avatar Jan 21 '23 02:01 Sajiyah-Salat

@Madhur97 @fazpeerbaksh Is this issue resolved? If not, I would like to work on this!

/assign

ashutosh887 avatar Apr 29 '23 02:04 ashutosh887

Since there is no PR on this issue since a long time I will assign it to myself and will work on it. /assign

impact-maker avatar Oct 03 '23 09:10 impact-maker