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

#3377 adding odo devfile support test #4179

Merged
merged 6 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,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:
rnapoles-rh marked this conversation as resolved.
Show resolved Hide resolved
ginkgo $(GINKGO_FLAGS) -focus="odo devfile supported tests" tests/e2escenarios/

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

import (
"strings"
"time"

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

. "github.com/onsi/ginkgo"
)

// Test Objective:
// Test ODO devfile support features
rnapoles-rh marked this conversation as resolved.
Show resolved Hide resolved

// 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
})

// preSetup := func() {
rnapoles-rh marked this conversation as resolved.
Show resolved Hide resolved
// 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", "--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() {
JustBeforeEach(func() {
helper.MakeDir(projectDirPath)
rnapoles-rh marked this conversation as resolved.
Show resolved Hide resolved
helper.Chdir(projectDirPath)
})
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")
})
})

})