-
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
Remove unnecessary devfile flag and update tests #3762
Remove unnecessary devfile flag and update tests #3762
Conversation
@cdrage @GeekArthur can you help review this PR? Thx |
@@ -46,7 +45,7 @@ func NewInfoOptions() *InfoOptions { | |||
|
|||
// Complete completes all the required options for port-forward cmd. | |||
func (o *InfoOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { | |||
if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(o.DevfilePath) { |
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.
Why was the other check removed? This will trigger NewDevfileContext
even for s2i components.
[mrinaldas@localhost project]$ odo create nodejs --s2i
Experimental mode is enabled, use at your own risk
Validation
✓ Validating component [2s]
Please use `odo push` command to create the component with source deployed
[mrinaldas@localhost project]$ odo debug info
✗ The current directory does not represent an odo component. Use 'odo create' to create component here or switch to directory with a component
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 didnt realize we had a s2i
flag for experimental, I was wondering what the point of the check was. Thanks for showing it out, will update it!
@@ -76,7 +76,7 @@ func (o *PortForwardOptions) Complete(name string, cmd *cobra.Command, args []st | |||
|
|||
o.isExperimental = experimental.IsExperimentalModeEnabled() | |||
|
|||
if o.isExperimental && util.CheckPathExists(o.DevfilePath) { |
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.
why was the other check removed?
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.
updated
@@ -41,7 +40,7 @@ func NewURLDeleteOptions() *URLDeleteOptions { | |||
// Complete completes URLDeleteOptions after they've been Deleted | |||
func (o *URLDeleteOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { | |||
|
|||
if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(o.DevfilePath) { |
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.
removing this check will make odo url delete
not work for s2i components
[mrinaldas@localhost project]$ odo create nodejs --s2i
Experimental mode is enabled, use at your own risk
Validation
✓ Validating component [1s]
Please use `odo push` command to create the component with source deployed
[mrinaldas@localhost project]$ odo url create example
✓ URL example created for component: nodejs-project-vwui
To apply the URL configuration changes, please use `odo push`
[mrinaldas@localhost project]$ odo url delete example
✗ The current directory does not represent an odo component. Use 'odo create' to create component here or switch to directory with a component
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.
updated
@@ -67,20 +67,20 @@ var _ = Describe("odo devfile debug command tests", func() { | |||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath) | |||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-debugrun.yaml"), filepath.Join(projectDirPath, "devfile-with-debugrun.yaml")) | |||
helper.RenameFile("devfile-with-debugrun.yaml", "devfile.yaml") | |||
helper.CmdShouldPass("odo", "push", "--debug") |
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 we are using context, I think we should also remove helper.Chdir(context)
from beforeEach
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.
it doesn't matter because the context path here is the full path to the component but nevertheless if i remove helper.Chdir(context)
, I need to update a bunch of statements because we're copying devfiles from the repo to the context.
And it looks like most of the other tests are doing this way ie; helper.Chdir(context)
and using --context
; so dont want the test to be inconsistent in the way its written. We should be updating all the tests where we use context to not chdir to the dir if we want to do it!
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.
it doesn't matter because the context path here is the full path to the component but nevertheless if i remove helper.Chdir(context), I need to update a bunch of statements because we're copying devfiles from the repo to the context.
We have had problems before where the context flag wasn't working but it was never detected because we were changing into the context directory. In such cases, the current directory might be used even though the context was passed.
We should be updating all the tests where we use context to not chdir to the dir if we want to do it!
Yes, we need this behavior to change and need a issue to track it.
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 have opened an issue here #3801 and yes ideally we should not do it
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.
Thanks 👍
/retest |
1 similar comment
/retest |
Codecov Report
@@ Coverage Diff @@
## master #3762 +/- ##
=======================================
Coverage 44.19% 44.19%
=======================================
Files 141 141
Lines 13600 13600
=======================================
Hits 6010 6010
Misses 7007 7007
Partials 583 583 Continue to review full report at Codecov.
|
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
/retest |
1 similar comment
/retest |
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.
Tests are green
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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 |
Signed-off-by: Maysun J Faisal maysun.j.faisal@ibm.com
What type of PR is this?
/kind bug
/kind cleanup
What does does this PR do / why we need it:
odo create
needs the devfile flag to copy contents from the specified flag to project dir/context dir devfile.yamlWhich issue(s) this PR fixes:
Fixes #3661
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: