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

Remove unnecessary devfile flag and update tests #3762

Merged
merged 3 commits into from
Aug 31, 2020

Conversation

maysunfaisal
Copy link
Contributor

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:

  • only odo create needs the devfile flag to copy contents from the specified flag to project dir/context dir devfile.yaml
  • devfile is always devfile.yaml, so no point in having a devfile flag for non create commands
  • commands listed in the issue do not require --devfile flag
  • there were some bugs when using --context and --devfile flags for the command listed, they have been fixed
  • updated integration tests

Which issue(s) this PR fixes:

Fixes #3661

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

  • Run the commands with the devfile flag; it should err out
  • Run the commands with the context flag, it should work

@openshift-ci-robot openshift-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. labels Aug 17, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Aug 17, 2020
@maysunfaisal
Copy link
Contributor Author

@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) {
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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

Copy link
Contributor Author

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")
Copy link
Contributor

@mik-dass mik-dass Aug 19, 2020

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

Copy link
Contributor Author

@maysunfaisal maysunfaisal Aug 19, 2020

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!

Copy link
Contributor

@mik-dass mik-dass Aug 20, 2020

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.

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks 👍

@maysunfaisal
Copy link
Contributor Author

/retest

1 similar comment
@maysunfaisal
Copy link
Contributor Author

/retest

@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #3762 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68bc98b...c54e8af. Read the comment docs.

maysunfaisal and others added 3 commits August 26, 2020 13:08
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>
@maysunfaisal
Copy link
Contributor Author

/retest

1 similar comment
@maysunfaisal
Copy link
Contributor Author

/retest

Copy link
Contributor

@mik-dass mik-dass left a 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

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Aug 28, 2020
@kadel
Copy link
Member

kadel commented Aug 31, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Aug 31, 2020
@openshift-merge-robot openshift-merge-robot merged commit ce2b6d0 into redhat-developer:master Aug 31, 2020
@rm3l rm3l added the area/refactoring Issues or PRs related to code refactoring label Jun 16, 2023
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. Required by Prow. area/refactoring Issues or PRs related to code refactoring kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove --devfile parameter from non odo create commands.
6 participants