Skip to content

Commit

Permalink
#3377 adding odo devfile support test (#4179)
Browse files Browse the repository at this point in the history
* #3377 adding odo devfile support test

* #3377 replaced spaces with a Tab

* #3377 updated focus value

* #3377 addressed all Priti's comments in PR

* #3377 addressed additional comments from Priti's comments in PR

* #3377 adding make test-e2e-devfile
  • Loading branch information
rnapoles-rh authored Nov 20, 2020
1 parent 025c2b6 commit 9200a7f
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
- travis_wait make test-e2e-java
- travis_wait make test-e2e-source
- travis_wait make test-e2e-images
- travis_wait make test-e2e-devfile
- odo logout

# Fix https://github.com/openshift/odo/issues/3714 to uncomment tests
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ test-e2e-source:
test-e2e-images:
ginkgo $(GINKGO_FLAGS) -focus="odo supported images e2e tests" tests/e2escenarios/

# Run devfile e2e tests: odo devfile supported tests
.PHONY: test-e2e-devfile
test-e2e-devfile:
ginkgo $(GINKGO_FLAGS) -focus="odo devfile supported tests" tests/e2escenarios/

# Run all e2e test scenarios
.PHONY: test-e2e-all
test-e2e-all:
Expand Down
80 changes: 80 additions & 0 deletions tests/e2escenarios/e2e_devfile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package e2escenarios

import (
"strings"
"time"

"github.com/openshift/odo/tests/helper"

. "github.com/onsi/ginkgo"
)

// Test Objective:
// Test ODO devfile support features

// Scope:
// Test debug support for the following components, making use of starter projects define in the corresponding devfile:
// - nodejs
// - java-springboot
// - java-quarkus
// - java-openliberty
// - java-maven, no starter project available at the time this script was developed, so skiping this component for now

var _ = Describe("odo devfile supported tests", func() {
var componentName, projectDirPath string
var projectDir = "/projectDir"
var commonVar helper.CommonVar

// This is run before every Spec (It)
var _ = BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
componentName = helper.RandString(6)
helper.Chdir(commonVar.Context)
projectDirPath = commonVar.Context + projectDir
helper.MakeDir(projectDirPath)
helper.Chdir(projectDirPath)
})

// This is run after every Spec (It)
var _ = AfterEach(func() {
helper.CommonAfterEach(commonVar)
})

createStarterProjAndSetDebug := func(component string) {
helper.CmdShouldPass("odo", "create", component, "--starter", "--project", commonVar.Project, componentName, "--context", projectDirPath)
helper.CmdShouldPass("odo", "push", "--context", projectDirPath)
helper.CmdShouldPass("odo", "push", "--debug", "--context", projectDirPath)

stopChannel := make(chan bool)
go func() {
helper.CmdShouldRunAndTerminate(60*time.Second, stopChannel, "odo", "debug", "port-forward", "--local-port", "5858", "--context", projectDirPath)
}()

// Make sure that the debug information output, outputs correctly.
// We do *not* check the json output since the debugProcessID will be different each time.
helper.WaitForCmdOut("odo", []string{"debug", "info", "-o", "json", "--context", projectDirPath}, 1, false, func(output string) bool {
if strings.Contains(output, `"kind": "OdoDebugInfo"`) &&
strings.Contains(output, `"localPort": 5858`) {
return true
}
return false
})
stopChannel <- true
}

Context("odo debug support for devfile components", func() {
It("Verify output debug information for nodeJS debug works", func() {
createStarterProjAndSetDebug("nodejs")
})
It("Verify output debug information for java-springboot works", func() {
createStarterProjAndSetDebug("java-springboot")
})
It("Verify output debug information for java-openliberty debug works", func() {
createStarterProjAndSetDebug("java-openliberty")
})
It("Verify output debug information for java-quarkus debug works", func() {
createStarterProjAndSetDebug("java-quarkus")
})
})

})

0 comments on commit 9200a7f

Please sign in to comment.