Skip to content
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

test: improve unit tests for container name autocompletion #124916

Conversation

TessaIO
Copy link
Contributor

@TessaIO TessaIO commented May 16, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Cleanup and add some tests for unit tests for container name autocompletion.

Which issue(s) this PR fixes:

Fixes kubernetes/kubectl#1600

Special notes for your reviewer:

Does this PR introduce a user-facing change?

N/A

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

N/A

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/code-generation area/kubectl sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 16, 2024
@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from 3e2c77f to fe37f03 Compare May 16, 2024 19:50
@TessaIO
Copy link
Contributor Author

TessaIO commented May 16, 2024

ping @ardaguclu @ah8ad3 since you already have context on this.

@TessaIO
Copy link
Contributor Author

TessaIO commented May 17, 2024

/retest

@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from fe37f03 to 834398a Compare May 17, 2024 07:39
Copy link
Member

@ah8ad3 ah8ad3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PR!
I haven't check to see if is there any other function that can be replaced with this test table too.

@TessaIO
Copy link
Contributor Author

TessaIO commented May 20, 2024

@ah8ad3 should I update all of them?

@ah8ad3
Copy link
Member

ah8ad3 commented May 20, 2024

should I update all of them?

My bad on not specifying my opinion, i think if there is for example 5 other tests that can be removed and put in the table here it would be better.
Updating all the tests could make reviews harder and maybe take long time to review.

@TessaIO
Copy link
Contributor Author

TessaIO commented May 20, 2024

should I update all of them?

My bad on not specifying my opinion, i think if there is for example 5 other tests that can be removed and put in the table here it would be better. Updating all the tests could make reviews harder and maybe take long time to review.

There are many of them in the completion_test.go. I suggest doing that in a separate PR to make the review easier. wdyt?

@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from 834398a to 62e410a Compare May 20, 2024 12:54
@TessaIO TessaIO requested a review from ah8ad3 May 20, 2024 12:54
@TessaIO
Copy link
Contributor Author

TessaIO commented May 20, 2024

/retest

Copy link
Member

@ah8ad3 ah8ad3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@seans3
Copy link
Contributor

seans3 commented May 21, 2024

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 21, 2024
@TessaIO
Copy link
Contributor Author

TessaIO commented May 22, 2024

ping @brianpursley @ardaguclu

@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from 62e410a to 2d2eaed Compare May 22, 2024 18:01
@TessaIO TessaIO requested a review from brianpursley May 22, 2024 18:01
@TessaIO
Copy link
Contributor Author

TessaIO commented May 22, 2024

@brianpursley thanks for the review! Updated and PTAL.

@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from 2d2eaed to f2b9286 Compare May 22, 2024 18:03
@TessaIO
Copy link
Contributor Author

TessaIO commented May 23, 2024

/retest

@brianpursley
Copy link
Member

I see the unit tests failed after moving the lines as I had suggested. I'm not sure why those lines need to be inside the loop, but there must be something that needs to be reset for each test (iostreams maybe?). I think you can put those lines back inside the loop like you had them and it should be fine.

Signed-off-by: TessaIO <ahmedgrati1999@gmail.com>
@TessaIO TessaIO force-pushed the test-improve-unit-tests-for-container-name-autocompletion branch from f2b9286 to fe81d0d Compare May 23, 2024 19:56
@TessaIO
Copy link
Contributor Author

TessaIO commented May 23, 2024

I see the unit tests failed after moving the lines as I had suggested. I'm not sure why those lines need to be inside the loop, but there must be something that needs to be reset for each test (iostreams maybe?). I think you can put those lines back inside the loop like you had them and it should be fine.

@brianpursley Thanks and done. Also maybe it's one of the reasons that previous tests were separated.
Anyways PTAL when you have time.

Copy link
Member

@ah8ad3 ah8ad3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 29, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 17e70aa1ae4a12d1fa00daf09f960c731cad0d31

@ardaguclu
Copy link
Member

That looks good to me and thank you. But next time it is better to work on the issues that are labelled with triage/accepted to prevent any waste of effort as request might be rejected by the maintainers.
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, TessaIO

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 31, 2024
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

1 similar comment
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot
Copy link
Contributor

@TessaIO: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-unit fe81d0d link true /test pull-kubernetes-unit

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot merged commit 723c269 into kubernetes:master May 31, 2024
13 of 14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/code-generation area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Improve tests for container-name autocompletion for exec commands
7 participants