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

Fix issue with failing NodeJS component after the container gets restarted #2265

Merged
merged 2 commits into from Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/occlient/occlient.go
Expand Up @@ -96,7 +96,7 @@ const (

// Default Image that will be used containing the supervisord binary and assembly scripts
// use getBoostrapperImage() function instead of this variable
defaultBootstrapperImage = "quay.io/openshiftdo/init:0.13.0"
defaultBootstrapperImage = "quay.io/openshiftdo/init:0.13.1"

// ENV variable to overwrite image used to bootstrap SupervisorD in S2I builder Image
bootstrapperImageEnvName = "ODO_BOOTSTRAPPER_IMAGE"
Expand Down
13 changes: 13 additions & 0 deletions tests/helper/helper_oc.go
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"regexp"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -393,3 +394,15 @@ func (oc *OcRunner) GetEnvs(componentName string, appName string, projectName st
}
return mapOutput
}

// WaitForDCRollout wait for DeploymentConfig to finish active rollout
// timeout is a maximum wait time in seconds
func (oc *OcRunner) WaitForDCRollout(dcName string, project string, timeout time.Duration) {
session := CmdRunner(oc.path, "rollout", "status",
"-w",
"-n", project,
"dc", dcName)

Eventually(session).Should(gexec.Exit(0), runningCmd(session.Command))
session.Wait(timeout)
}
12 changes: 11 additions & 1 deletion tests/integration/servicecatalog/cmd_link_unlink_test.go
Expand Up @@ -74,7 +74,7 @@ var _ = Describe("odo link and unlink command tests", func() {
})
})

Context("When handiling link/unlink between components", func() {
Context("When handling link/unlink between components", func() {
JustBeforeEach(func() {
context1 = helper.CreateNewContext()
context2 = helper.CreateNewContext()
Expand All @@ -86,14 +86,24 @@ var _ = Describe("odo link and unlink command tests", func() {
It("should link the frontend application to the backend and then unlink successfully", func() {
helper.CopyExample(filepath.Join("source", "nodejs"), context1)
helper.CmdShouldPass("odo", "create", "nodejs", "frontend", "--context", context1, "--project", project)
helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", context1)
helper.CmdShouldPass("odo", "push", "--context", context1)
frontendUrl := helper.DetermineRouteURL(context1)
helper.CopyExample(filepath.Join("source", "python"), context2)
helper.CmdShouldPass("odo", "create", "python", "backend", "--context", context2, "--project", project)
helper.CmdShouldPass("odo", "url", "create", "--context", context2)
helper.CmdShouldPass("odo", "push", "--context", context2)

helper.CmdShouldPass("odo", "link", "backend", "--component", "frontend", "--project", project, "--context", context2)
// ensure that the proper envFrom entry was created
envFromOutput := oc.GetEnvFromEntry("frontend", "app", project)
Expect(envFromOutput).To(ContainSubstring("backend"))

dcName := oc.GetDcName("frontend", project)
// wait for DeploymentConfig rollout to finish, so we can check if application is successfully running
oc.WaitForDCRollout(dcName, project, 20*time.Second)
helper.HttpWaitFor(frontendUrl, "Hello world from node.js!", 20, 1)

outputErr := helper.CmdShouldFail("odo", "link", "backend", "--component", "frontend", "--project", project, "--context", context2)
Expect(outputErr).To(ContainSubstring("been linked"))
helper.CmdShouldPass("odo", "unlink", "backend", "--component", "frontend", "--project", project, "--context", context2)
Expand Down