Skip to content

Commit

Permalink
Fix --app and --all-apps coexist
Browse files Browse the repository at this point in the history
  • Loading branch information
jichenjc committed May 18, 2020
1 parent b26a1f5 commit 8b93c40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/odo/cli/component/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func (lo *ListOptions) Validate() (err error) {

var project, app string

if len(lo.Application) != 0 && lo.allAppsFlag {
return odoutil.ThrowContextError()
}

if !util.CheckKubeConfigExist() {
project = lo.LocalConfigInfo.GetProject()
app = lo.LocalConfigInfo.GetApplication()
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/cmd_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ var _ = Describe("odo watch command tests", func() {
})
})

Context("when executing odo watch against an app that doesn't exist", func() {
JustBeforeEach(func() {
currentWorkingDirectory = helper.Getwd()
helper.Chdir(context)
})
JustAfterEach(func() {
helper.Chdir(currentWorkingDirectory)
})
It("should fail with proper error", func() {
helper.CopyExample(filepath.Join("source", "nodejs"), context)
helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project)
output := helper.CmdShouldFail("odo", "watch", "--app", "dummy")
Expect(output).To(ContainSubstring("component does not exist"))
})
})

Context("when executing watch on a git source type component", func() {
It("should fail", func() {
helper.CmdShouldPass("odo", "create", "--context", context, "nodejs", "--git", "https://github.com/openshift/nodejs-ex.git")
Expand Down

0 comments on commit 8b93c40

Please sign in to comment.