-
Notifications
You must be signed in to change notification settings - Fork 243
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
cleanup #3403: removed --memory, --min-memory. --max-memory, --cpu, --min-cpu, --max-cpu flags from 'odo create' command #3475
cleanup #3403: removed --memory, --min-memory. --max-memory, --cpu, --min-cpu, --max-cpu flags from 'odo create' command #3475
Conversation
Skipping CI for Draft Pull Request. |
Codecov Report
@@ Coverage Diff @@
## master #3475 +/- ##
==========================================
+ Coverage 45.50% 45.63% +0.12%
==========================================
Files 116 122 +6
Lines 11712 12247 +535
==========================================
+ Hits 5330 5589 +259
- Misses 5862 6107 +245
- Partials 520 551 +31
Continue to review full report at Codecov.
|
d3d01cc
to
cd3d588
Compare
pkg/odo/cli/component/update.go
Outdated
// Add a disclaimer that we are in *experimental mode* | ||
log.Experimental("Experimental mode is enabled, use at your own risk") | ||
|
||
// Configure the context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are talking about configuring the devfile context. Can we change it to Configure the devfile context
to be more specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change was supposed to be a part of #3453 . I included this here by mistake.
cd3d588
to
41b466d
Compare
41b466d
to
bd9a6da
Compare
1ab16d7
to
d714c6c
Compare
@@ -1044,33 +1004,6 @@ func (co *CreateOptions) Run() (err error) { | |||
return | |||
} | |||
|
|||
// The general cpu/memory is used as a fallback when it's set and both min-cpu/memory max-cpu/memory are not set | |||
// when the only thing specified is the min or max value, we exit the application | |||
func ensureAndLogProperResourceUsage(resource, resourceMin, resourceMax, resourceName string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These validations might need to happen at push now, as a user can set them using odo config and then push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or better yet when these are set using odo config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a new commit to add validation for push
and config set
command. Would that suffice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
1a9b183
to
210ad46
Compare
@dev-gaur It seems a real failure to me
Can you please look into this and also is it a WIP pr, if yes can you please change the title accordingly. |
210ad46
to
845a7ce
Compare
Hi, sorry I pushed that change in haste without verifying locally as it was trivial. Fixed it now. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: girishramnani 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 |
shouldn't we have tests on config side now to validate improper values @dev-gaur ? |
/retest |
tests/integration/cmd_push_test.go
Outdated
|
||
helper.CmdShouldPass("odo", "config", "set", "minmemory", "100Mi", "--context", context) | ||
output := helper.CmdShouldFail("odo", "push", "--context", context) | ||
Expect(output).To(ContainSubstring("`minmemory` should accompany `maxmemory` or use `odo config set memory` to use same value for both min and max or try not passing any of them")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message should be straight forward instead, right.
I would say also in the code implementation make the message pretty straight forward like minmemory should accompany maxmemory, so use `odo config set memory` to use same value for both min and max
tests/integration/cmd_push_test.go
Outdated
Expect(output).To(ContainSubstring("`minmemory` should accompany `maxmemory` or use `odo config set memory` to use same value for both min and max or try not passing any of them")) | ||
}) | ||
|
||
It("Should work when both mincpu and maxcpu is set..", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it,. It has been covered in config integration test file
@@ -41,7 +41,10 @@ var _ = Describe("odo supported images e2e tests", func() { | |||
|
|||
// create the component | |||
helper.CopyExample(filepath.Join("source", srcType), context) | |||
helper.CmdShouldPass("odo", "create", cmpType, srcType+"-app", "--project", project, "--context", context, "--app", appName, "--min-memory", "400Mi", "--max-memory", "700Mi") | |||
helper.CmdShouldPass("odo", "create", cmpType, srcType+"-app", "--project", project, "--context", context, "--app", appName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e test stands for broader user specific scenario. These validation can be done through UTs or integration test label. So please remove those lines.
Ofcourse if we find a user specific scenario where we have such hard requirement of adding those validation then we will add these line for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't trim the memory and cpu flags from here then this will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh...got it. I did not realize it. Sorry for the false alarm.
tests/integration/cmd_push_test.go
Outdated
@@ -53,6 +53,94 @@ var _ = Describe("odo push command tests", func() { | |||
|
|||
}) | |||
|
|||
Context("Check memory and cpu config before odo push", func() { | |||
It("Should work when both minmemory and maxmemory is set..", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it. It has been covered in config integration test file.
Expect(output).To(ContainSubstring("`minmemory` should accompany `maxmemory` or use `odo config set memory` to use same value for both min and max or try not passing any of them")) | ||
}) | ||
|
||
It("should fail if maxmemory is set but minmemory is not set..", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these validation be done through UTs instead of over crowding the integration test file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it covers multiple packages. Not just config package. It cannot be covered in UTs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The memory and cpu is set in config package but the overall/e2e validation of config parameters occur in component push package
helper.CmdShouldPass("odo", "push", "--context", context) | ||
}) | ||
|
||
It("Should work when cpu is set", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cna it be done through code level validation i mean through UTs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I don't think so, due to the same reason I mentioned above.
helper.CmdShouldPass("odo", "push", "--context", context) | ||
}) | ||
|
||
It("Should fail if mincpu is set but maxcpu is not set..", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be done through code level validation i mean through UTs ?
Expect(output).To(ContainSubstring("`mincpu` should accompany `maxcpu` or use `odo config set cpu` to use same value for both min and max or try not passing any of them")) | ||
}) | ||
|
||
It("should fail if maxcpu is set but mincpu is not set..", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be done through code level validation i mean through UTs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dev-gaur Theses flags are applicable for devfile component aswell, so can you please test one negative and one happy path scenario with devfile component push.
/retest |
$ odo config set MinMemory -1M
Error: unknown shorthand flag: '1' in -1M
$ odo config set MinMemory "-1M"
Error: unknown shorthand flag: '1' in -1M
$ odo version
odo v1.2.4 (f1ff2087e) I'm expecting the function at https://github.com/openshift/odo/pull/3475/files#diff-cf69f55cdfd58073682104f12e305dd8R45 to show me a proper error message. Am I doint something wrong? |
This message isn't coming from the odo code, but the package that we have imported to detect flags to the cli. Its detecting -1 as a provided flag value. I'm not sure how can I override that. |
Then which scenario(s) does |
I just added it as an additional measure. If somehow user managers to override the package and pass the negative values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest Please review the full test history for this PR and help us cut down flakes. |
12 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@dev-gaur: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What does does this PR do / why we need it:
Cleans up and remove the memory and cpu flags from
odo create
command.There parameters can be set using
odo config
command.Which issue(s) this PR fixes:
#3403
How to test changes / Special notes to the reviewer: