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

Don't allow creating profile by profile command #6672

Merged
merged 5 commits into from
Feb 20, 2020

Conversation

aallbrig
Copy link
Contributor

The Change Set

Fixes #6647

This updates profile to no longer create profiles that do not exist and provides feedback to user on how to create the non-existent profile.

Just One Snag...

One thing brought up in the issue that doesn't appear to be true is...

however, 'minikube profile pname'
should still change the profile to 'pname' if it exists. but should not create a new one.

However; minikube profile pname does not change profile to pname before this change set. This seems like it would be new functionality

$ minikube create -p profile
$ minikube profile pname

Instead of renaming profile to pname, it instead creates a pname profile that needs to be deleted.

TLDR; This aspect of issue #6647 may be a new feature request because this behavior does not exist today.

See below screenshots.

Screenshot 2020-02-17 18 53 24

Screenshot 2020-02-17 18 53 33

Screenshot 2020-02-17 18 53 43

Screenshot 2020-02-17 18 53 54

Screenshot 2020-02-17 18 54 01

Screenshot 2020-02-17 19 04 47

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 18, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @aallbrig. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 18, 2020
@aallbrig aallbrig changed the title Do not create profiles that do not exist Profile command should not create non existent profiles Feb 18, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aallbrig
To complete the pull request process, please assign sharifelgamal
You can assign the PR to them by writing /assign @sharifelgamal in a comment when ready.

The full list of commands accepted by this bot can be found 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

@codecov-io
Copy link

Codecov Report

Merging #6672 into master will increase coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6672      +/-   ##
==========================================
+ Coverage   38.56%   38.58%   +0.01%     
==========================================
  Files         142      142              
  Lines        8642     8639       -3     
==========================================
  Hits         3333     3333              
+ Misses       4893     4890       -3     
  Partials      416      416
Impacted Files Coverage Δ
cmd/minikube/cmd/config/profile.go 0% <0%> (ø) ⬆️

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@medyagh
Copy link
Member

medyagh commented Feb 18, 2020

Thank you for the pr. Do you mind adding integration tests for this ?

You could look up examples of functional tests and add one more tests under functional tests

@aallbrig
Copy link
Contributor Author

@medyagh I can but not tonight. I’m spending time with the fiancé for the rest of the night.

It’s 9:14 p.m. EST. I’ll see about getting this done between 7 a.m. and 8 a.m. tomorrow.

@aallbrig
Copy link
Contributor Author

@medyagh I'm on it now

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 18, 2020
@aallbrig aallbrig force-pushed the profile-command-improvement branch from 07a847d to 089deef Compare February 18, 2020 11:07
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 18, 2020
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 18, 2020
@aallbrig
Copy link
Contributor Author

@medyagh I found that there were integration tests for profile already existing! I created tests for nonexistent profiles and the desired behavior described in the issue.

I look forward to your review. Its 7:12 a.m. EST now. I'll have a block of time during lunch and another block of time after work to address feedback you (or others) provide.

@aallbrig
Copy link
Contributor Author

@medyagh Is there anything else I can do?

@RA489
Copy link

RA489 commented Feb 19, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 19, 2020
@minikube-pr-bot
Copy link

Error: running mkcmp: exit status 1

@medyagh
Copy link
Member

medyagh commented Feb 19, 2020

@aallbrig thank you so much for this PR ! this looks good to me just a small nit. and thank you for adding integraiotn tests for it too

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

this PR is short and sweet and is great ! and fixes an annoyance for the users.
thank you just a small request to improve the integration tests (parse the json output instead of parsing the stdoutput )

if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
}
for _, line := range []string{fmt.Sprintf("Created a new profile : %s", nonexistentProfile), fmt.Sprintf("minikube profile was successfully set to %s", nonexistentProfile)} {
Copy link
Member

Choose a reason for hiding this comment

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

how about instead of parsing the output, do a
"minikube profile list --output=json" and expect not to see the "lis" in the created profiles?

Copy link
Contributor Author

@aallbrig aallbrig Feb 19, 2020

Choose a reason for hiding this comment

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

Absolutely! I’ll update it today

@aallbrig
Copy link
Contributor Author

@medyagh Touching base: doing a trivia night with friends & S.Os. My plan is to do the refactor later today. Cheers!

@medyagh
Copy link
Member

medyagh commented Feb 20, 2020

trivia night with friends & S.Os. My plan is to do the refactor later today. Cheers!

thanks for keeping me up to date ! have fun at the trivia :)

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 20, 2020
@aallbrig
Copy link
Contributor Author

@medyagh Updated tests to use JSON output to determine expected behavior. Please let me know how I can improve this change set :)

@minikube-pr-bot
Copy link

All Times minikube: [ 96.652477 93.172916 92.120139]
All Times Minikube (PR 6672): [ 90.669450 94.047599 94.918137]

Average minikube: 93.981844
Average Minikube (PR 6672): 93.211729

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6672) |
+----------------------+-----------+--------------------+
| minikube v           |  0.204334 |           0.198410 |
| Creating kvm2        | 21.452039 |          19.962150 |
| Preparing Kubernetes | 49.761131 |          50.326659 |
| Pulling images       |           |                    |
| Launching Kubernetes | 20.886641 |          20.705711 |
| Waiting for cluster  |  0.054255 |           0.059329 |
+----------------------+-----------+--------------------+

@medyagh medyagh merged commit a5c76f8 into kubernetes:master Feb 20, 2020
@medyagh medyagh changed the title Profile command should not create non existent profiles don't allow creating profile by profile command Feb 20, 2020
@medyagh medyagh changed the title don't allow creating profile by profile command Don't allow creating profile by profile command Feb 20, 2020
@aallbrig
Copy link
Contributor Author

Woohoo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent minikube profile command to create profile
7 participants