-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 commentThe 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. |
||
|
||
helper.CmdShouldPass("odo", "config", "set", "minmemory", "400Mi", "--context", context) | ||
helper.CmdShouldPass("odo", "config", "set", "maxmemory", "700Mi", "--context", context) | ||
|
||
// push component and validate | ||
helper.CmdShouldPass("odo", "push", "--context", context) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,72 @@ var _ = Describe("odo push command tests", func() { | |
|
||
}) | ||
|
||
Context("Check memory and cpu config before odo push", func() { | ||
It("Should work when memory is set..", func() { | ||
|
||
helper.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
helper.CmdShouldPass("odo", "config", "set", "Memory", "300Mi", "--context", context) | ||
helper.CmdShouldPass("odo", "push", "--context", context) | ||
}) | ||
|
||
It("Should fail if minMemory is set but maxmemory is not set..", func() { | ||
|
||
helper.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
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")) | ||
}) | ||
|
||
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 commentThe 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 commentThe 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 commentThe 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.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
helper.CmdShouldPass("odo", "config", "set", "maxmemory", "400Mi", "--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")) | ||
}) | ||
|
||
It("Should work when cpu is set", func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
helper.CmdShouldPass("odo", "config", "set", "cpu", "0.4", "--context", context) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Can it be done through code level validation i mean through UTs ? |
||
|
||
helper.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
helper.CmdShouldPass("odo", "config", "set", "mincpu", "0.4", "--context", context) | ||
output := helper.CmdShouldFail("odo", "push", "--context", context) | ||
Expect(output).To(ContainSubstring("`mincpu` should accompany `maxcpu` or use `odo config set cpu` to use same value for both min and max")) | ||
}) | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Can it be done through code level validation i mean through UTs ? |
||
|
||
helper.CopyExample(filepath.Join("source", "nodejs"), context) | ||
|
||
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) | ||
|
||
helper.CmdShouldPass("odo", "config", "set", "maxcpu", "0.5", "--context", context) | ||
output := helper.CmdShouldFail("odo", "push", "--context", context) | ||
Expect(output).To(ContainSubstring("`mincpu` should accompany `maxcpu` or use `odo config set cpu` to use same value for both min and max")) | ||
}) | ||
}) | ||
|
||
Context("Check for label propagation after pushing", func() { | ||
|
||
It("Check for labels", 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.
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
andconfig 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