mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Integration tests for odo dev running on podman (#6332)
* Change signature of StartDevMode to use options structure * Add tests for odo dev on podman * Uncomment commented code * Update Makefile Co-authored-by: Armel Soro <armel@rm3l.org> Co-authored-by: Armel Soro <armel@rm3l.org>
This commit is contained in:
8
Makefile
8
Makefile
@@ -53,6 +53,8 @@ GINKGO_FLAGS_ALL = $(GINKGO_TEST_ARGS) --randomize-all --slow-spec-threshold=$(S
|
||||
GINKGO_FLAGS_AUTO = $(GINKGO_FLAGS_ALL) -p
|
||||
# Flags for tests that may be run in parallel
|
||||
GINKGO_FLAGS=$(GINKGO_FLAGS_ALL) -nodes=$(TEST_EXEC_NODES)
|
||||
# Flags for tests that must not be run in parallel
|
||||
GINKGO_FLAGS_ONE=$(GINKGO_FLAGS_ALL) -nodes=1
|
||||
# GolangCi version for unit-validate test
|
||||
GOLANGCI_LINT_VERSION=1.49.0
|
||||
|
||||
@@ -190,12 +192,16 @@ openshiftci-presubmit-unittests:
|
||||
|
||||
.PHONY: test-integration-cluster
|
||||
test-integration-cluster:
|
||||
$(RUN_GINKGO) $(GINKGO_FLAGS) --junit-report="test-integration.xml" --label-filter="!nocluster" tests/integration
|
||||
$(RUN_GINKGO) $(GINKGO_FLAGS) --junit-report="test-integration.xml" --label-filter="!nocluster && !podman" tests/integration
|
||||
|
||||
.PHONY: test-integration-no-cluster
|
||||
test-integration-no-cluster:
|
||||
$(RUN_GINKGO) $(GINKGO_FLAGS_AUTO) --junit-report="test-integration-nc.xml" --label-filter=nocluster tests/integration
|
||||
|
||||
.PHONY: test-integration-podman
|
||||
test-integration-podman:
|
||||
$(RUN_GINKGO) $(GINKGO_FLAGS_ONE) --junit-report="test-integration-podman.xml" --label-filter=podman tests/integration
|
||||
|
||||
.PHONY: test-integration
|
||||
test-integration: test-integration-no-cluster test-integration-cluster
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ var _ = Describe("odo devfile supported tests", func() {
|
||||
defer helper.Chdir(workingDir)
|
||||
helper.Chdir(projectDirPath)
|
||||
helper.Cmd("odo", "init", "--name", componentName, "--devfile", component, "--starter", starter).ShouldPass()
|
||||
session, _, _, _, err := helper.StartDevMode(nil)
|
||||
session, _, _, _, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session.Stop()
|
||||
session.WaitEnd()
|
||||
|
||||
@@ -76,7 +76,7 @@ var _ = Describe("E2E Test", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "server.js"), "from Node.js", "from updated Node.js")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, _, _, err = devSession.WaitSync()
|
||||
@@ -119,7 +119,7 @@ var _ = Describe("E2E Test", func() {
|
||||
helper.MatchAllInOutput(stdout, []string{componentName, "nodejs", "Deploy"})
|
||||
|
||||
// start dev mode again
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// making changes to the project again
|
||||
@@ -193,7 +193,7 @@ var _ = Describe("E2E Test", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "server.js"), "from Node.js", "from updated Node.js")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@@ -239,7 +239,7 @@ var _ = Describe("E2E Test", func() {
|
||||
helper.MatchAllInOutput(stdout, []string{componentName, "nodejs", "Deploy"})
|
||||
|
||||
// start dev mode again
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// making changes to the project again
|
||||
|
||||
@@ -114,25 +114,34 @@ type DevSession struct {
|
||||
console *expect.Console
|
||||
}
|
||||
|
||||
type DevSessionOpts struct {
|
||||
EnvVars []string
|
||||
CmdlineArgs []string
|
||||
RunOnPodman bool
|
||||
}
|
||||
|
||||
// StartDevMode starts a dev session with `odo dev`
|
||||
// It returns a session structure, the contents of the standard and error outputs
|
||||
// and the redirections endpoints to access ports opened by component
|
||||
// when the dev mode is completely started
|
||||
func StartDevMode(envvars []string, opts ...string) (DevSession, []byte, []byte, map[string]string, error) {
|
||||
|
||||
func StartDevMode(options DevSessionOpts) (DevSession, []byte, []byte, map[string]string, error) {
|
||||
if options.RunOnPodman {
|
||||
options.CmdlineArgs = append(options.CmdlineArgs, "--run-on", "podman")
|
||||
options.EnvVars = append(options.EnvVars, "ODO_EXPERIMENTAL_MODE=true")
|
||||
}
|
||||
c, err := expect.NewConsole(expect.WithStdout(os.Stdout))
|
||||
if err != nil {
|
||||
return DevSession{}, nil, nil, nil, err
|
||||
}
|
||||
|
||||
args := []string{"dev", "--random-ports"}
|
||||
args = append(args, opts...)
|
||||
args = append(args, options.CmdlineArgs...)
|
||||
cmd := Cmd("odo", args...)
|
||||
cmd.Cmd.Stdin = c.Tty()
|
||||
cmd.Cmd.Stdout = c.Tty()
|
||||
cmd.Cmd.Stderr = c.Tty()
|
||||
|
||||
session := cmd.AddEnv(envvars...).Runner().session
|
||||
session := cmd.AddEnv(options.EnvVars...).Runner().session
|
||||
WaitForOutputToContain("[Ctrl+c] - Exit", 360, 10, session)
|
||||
result := DevSession{
|
||||
session: session,
|
||||
@@ -229,7 +238,10 @@ func (o DevSession) CheckNotSynced(timeout time.Duration) {
|
||||
// The inside handler is passed the internal session pointer, the contents of the standard and error outputs,
|
||||
// and a slice of strings - ports - giving the redirections in the form localhost:<port_number> to access ports opened by component
|
||||
func RunDevMode(additionalOpts []string, envvars []string, inside func(session *gexec.Session, outContents []byte, errContents []byte, ports map[string]string)) error {
|
||||
session, outContents, errContents, urls, err := StartDevMode(envvars, additionalOpts...)
|
||||
session, outContents, errContents, urls, err := StartDevMode(DevSessionOpts{
|
||||
EnvVars: envvars,
|
||||
CmdlineArgs: additionalOpts,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
LabelNoCluster = "nocluster"
|
||||
LabelPodman = "podman"
|
||||
)
|
||||
|
||||
func NeedsCluster(labels []string) bool {
|
||||
@@ -9,6 +14,18 @@ func NeedsCluster(labels []string) bool {
|
||||
if label == LabelNoCluster {
|
||||
return false
|
||||
}
|
||||
if label == LabelPodman {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func LabelPodmanIf(value bool, args ...interface{}) []interface{} {
|
||||
res := []interface{}{}
|
||||
if value {
|
||||
res = append(res, ginkgo.Label(LabelPodman))
|
||||
}
|
||||
res = append(res, args...)
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ status:
|
||||
|
||||
When("odo dev is run", func() {
|
||||
BeforeEach(func() {
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -265,7 +265,7 @@ status:
|
||||
|
||||
When("odo dev is run", func() {
|
||||
BeforeEach(func() {
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ var _ = Describe("odo delete command tests", func() {
|
||||
var devSession helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
devSession.Kill()
|
||||
|
||||
@@ -176,7 +176,7 @@ var _ = Describe("odo describe component command tests", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ var _ = Describe("odo describe/list binding command tests", func() {
|
||||
var session helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ var _ = Describe("odo dev debug command tests", func() {
|
||||
var ports map[string]string
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil, "--debug")
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--debug"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -97,7 +99,9 @@ var _ = Describe("odo dev debug command tests", func() {
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, stdout, stderr, ports, err = helper.StartDevMode(nil, "--debug")
|
||||
session, stdout, stderr, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--debug"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -168,7 +172,10 @@ var _ = Describe("odo dev debug command tests", func() {
|
||||
BeforeEach(func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-composite-apply-commands.yaml"), filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
session, sessionOut, _, ports, err = helper.StartDevMode([]string{"PODMAN_CMD=echo"}, "--debug")
|
||||
session, sessionOut, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
EnvVars: []string{"PODMAN_CMD=echo"},
|
||||
CmdlineArgs: []string{"--debug"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
It("should execute the composite apply commands successfully", func() {
|
||||
@@ -254,7 +261,9 @@ var _ = Describe("odo dev debug command tests", func() {
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, stdout, stderr, ports, err = helper.StartDevMode(nil, "--debug")
|
||||
session, stdout, stderr, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--debug"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
@@ -189,28 +189,36 @@ var _ = Describe("odo dev command tests", func() {
|
||||
})
|
||||
})
|
||||
|
||||
When("recording telemetry data", func() {
|
||||
BeforeEach(func() {
|
||||
helper.EnableTelemetryDebug()
|
||||
session, _, _, _, _ := helper.StartDevMode(nil)
|
||||
session.Stop()
|
||||
session.WaitEnd()
|
||||
})
|
||||
AfterEach(func() {
|
||||
helper.ResetTelemetry()
|
||||
})
|
||||
It("should record the telemetry data correctly", func() {
|
||||
td := helper.GetTelemetryDebugData()
|
||||
Expect(td.Event).To(ContainSubstring("odo dev"))
|
||||
Expect(td.Properties.Success).To(BeFalse())
|
||||
Expect(td.Properties.Error).ToNot(ContainSubstring("user interrupted"))
|
||||
Expect(td.Properties.CmdProperties[segment.ComponentType]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties[segment.Language]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties[segment.ProjectType]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties).Should(HaveKey(segment.Caller))
|
||||
Expect(td.Properties.CmdProperties[segment.Caller]).To(BeEmpty())
|
||||
})
|
||||
})
|
||||
for _, podman := range []bool{true, false} {
|
||||
podman := podman
|
||||
When("recording telemetry data", helper.LabelPodmanIf(podman, func() {
|
||||
BeforeEach(func() {
|
||||
helper.EnableTelemetryDebug()
|
||||
session, _, _, _, _ := helper.StartDevMode(helper.DevSessionOpts{
|
||||
RunOnPodman: podman,
|
||||
})
|
||||
session.Stop()
|
||||
session.WaitEnd()
|
||||
})
|
||||
AfterEach(func() {
|
||||
helper.ResetTelemetry()
|
||||
})
|
||||
It("should record the telemetry data correctly", func() {
|
||||
td := helper.GetTelemetryDebugData()
|
||||
Expect(td.Event).To(ContainSubstring("odo dev"))
|
||||
if !podman {
|
||||
// TODO(feloy) what should be the correct exit code for odo dev after pressing ctrl-c?
|
||||
Expect(td.Properties.Success).To(BeFalse())
|
||||
}
|
||||
Expect(td.Properties.Error).ToNot(ContainSubstring("user interrupted"))
|
||||
Expect(td.Properties.CmdProperties[segment.ComponentType]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties[segment.Language]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties[segment.ProjectType]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties).Should(HaveKey(segment.Caller))
|
||||
Expect(td.Properties.CmdProperties[segment.Caller]).To(BeEmpty())
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
When("an env.yaml file contains a non-current Project", func() {
|
||||
BeforeEach(func() {
|
||||
@@ -230,7 +238,7 @@ ComponentSettings:
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -255,7 +263,7 @@ ComponentSettings:
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -279,7 +287,7 @@ ComponentSettings:
|
||||
BeforeEach(func() {
|
||||
helper.Cmd("odo", "preference", "set", "-f", "Ephemeral", "false").ShouldPass()
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -335,7 +343,7 @@ ComponentSettings:
|
||||
BeforeEach(func() {
|
||||
helper.Cmd("odo", "preference", "set", "-f", "Ephemeral", "false").ShouldPass()
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -382,7 +390,9 @@ ComponentSettings:
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil, "--no-watch")
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--no-watch"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -435,7 +445,7 @@ ComponentSettings:
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "npm start", "sleep 20 ; npm start")
|
||||
|
||||
var err error
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -493,7 +503,9 @@ ComponentSettings:
|
||||
func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", devfile.devfileName), filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
devSession, _, _, _, err = helper.StartDevMode(devfile.envvars)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
EnvVars: devfile.envvars,
|
||||
})
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// ensure the deployment is created by `odo dev`
|
||||
@@ -534,7 +546,7 @@ ComponentSettings:
|
||||
func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-k8s-resource.yaml"), filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -548,153 +560,170 @@ ComponentSettings:
|
||||
})
|
||||
|
||||
for _, manual := range []bool{false, true} {
|
||||
manual := manual
|
||||
Context("port-forwarding for the component", func() {
|
||||
When("devfile has single endpoint", func() {
|
||||
BeforeEach(func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
helper.Cmd("odo", "set", "project", commonVar.Project).ShouldPass()
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass()
|
||||
})
|
||||
|
||||
When("running odo dev", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
for _, podman := range []bool{false, true} {
|
||||
manual := manual
|
||||
podman := podman
|
||||
Context("port-forwarding for the component", helper.LabelPodmanIf(podman, func() {
|
||||
When("devfile has single endpoint", func() {
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
opts := []string{}
|
||||
if manual {
|
||||
opts = append(opts, "--no-watch")
|
||||
if !podman {
|
||||
helper.Cmd("odo", "set", "project", commonVar.Project).ShouldPass()
|
||||
}
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil, opts...)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass()
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
devSession.Stop()
|
||||
devSession.WaitEnd()
|
||||
})
|
||||
|
||||
It("should expose the endpoint on localhost", func() {
|
||||
url := fmt.Sprintf("http://%s", ports["3000"])
|
||||
resp, err := http.Get(url)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
helper.MatchAllInOutput(string(body), []string{"Hello from Node.js Starter Application!"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
When("modifying memoryLimit for container in Devfile", func() {
|
||||
When("running odo dev", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
BeforeEach(func() {
|
||||
src := "memoryLimit: 1024Mi"
|
||||
dst := "memoryLimit: 1023Mi"
|
||||
helper.ReplaceString("devfile.yaml", src, dst)
|
||||
if manual {
|
||||
if os.Getenv("SKIP_KEY_PRESS") == "true" {
|
||||
Skip("This is a unix-terminal specific scenario, skipping")
|
||||
}
|
||||
|
||||
devSession.PressKey('p')
|
||||
}
|
||||
var err error
|
||||
_, _, ports, err = devSession.WaitSync()
|
||||
Expect(err).Should(Succeed())
|
||||
opts := []string{}
|
||||
if manual {
|
||||
opts = append(opts, "--no-watch")
|
||||
}
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: opts,
|
||||
RunOnPodman: podman,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
devSession.Stop()
|
||||
devSession.WaitEnd()
|
||||
})
|
||||
|
||||
It("should expose the endpoint on localhost", func() {
|
||||
By("updating the pod", func() {
|
||||
podName := commonVar.CliRunner.GetRunningPodNameByComponent(cmpName, commonVar.Project)
|
||||
bufferOutput := commonVar.CliRunner.Run("get", "pods", podName, "-o", "jsonpath='{.spec.containers[0].resources.requests.memory}'").Out.Contents()
|
||||
output := string(bufferOutput)
|
||||
Expect(output).To(ContainSubstring("1023Mi"))
|
||||
})
|
||||
|
||||
By("exposing the endpoint", func() {
|
||||
url := fmt.Sprintf("http://%s", ports["3000"])
|
||||
resp, err := http.Get(url)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
helper.MatchAllInOutput(string(body), []string{"Hello from Node.js Starter Application!"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
When("devfile has multiple endpoints", func() {
|
||||
BeforeEach(func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project-with-multiple-endpoints"), commonVar.Context)
|
||||
helper.Cmd("odo", "set", "project", commonVar.Project).ShouldPass()
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-multiple-endpoints.yaml")).ShouldPass()
|
||||
})
|
||||
|
||||
When("running odo dev", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
BeforeEach(func() {
|
||||
opts := []string{}
|
||||
if manual {
|
||||
opts = append(opts, "--no-watch")
|
||||
}
|
||||
var err error
|
||||
devSession, _, _, ports, err = helper.StartDevMode(nil, opts...)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
devSession.Stop()
|
||||
devSession.WaitEnd()
|
||||
})
|
||||
|
||||
It("should expose all endpoints on localhost regardless of exposure", func() {
|
||||
getServerResponse := func(p int) string {
|
||||
resp, err := http.Get(fmt.Sprintf("http://%s", ports[strconv.Itoa(p)]))
|
||||
url := fmt.Sprintf("http://%s", ports["3000"])
|
||||
resp, err := http.Get(url)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return string(body)
|
||||
}
|
||||
containerPorts := []int{3000, 4567, 7890}
|
||||
helper.MatchAllInOutput(string(body), []string{"Hello from Node.js Starter Application!"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
for _, p := range containerPorts {
|
||||
By(fmt.Sprintf("exposing a port targeting container port %d", p), func() {
|
||||
r := getServerResponse(p)
|
||||
helper.MatchAllInOutput(r, []string{"Hello from Node.js Starter Application!"})
|
||||
})
|
||||
}
|
||||
if !podman {
|
||||
When("modifying memoryLimit for container in Devfile", func() {
|
||||
BeforeEach(func() {
|
||||
src := "memoryLimit: 1024Mi"
|
||||
dst := "memoryLimit: 1023Mi"
|
||||
helper.ReplaceString("devfile.yaml", src, dst)
|
||||
if manual {
|
||||
if os.Getenv("SKIP_KEY_PRESS") == "true" {
|
||||
Skip("This is a unix-terminal specific scenario, skipping")
|
||||
}
|
||||
|
||||
helper.ReplaceString("server.js", "Hello from Node.js", "H3110 from Node.js")
|
||||
|
||||
if manual {
|
||||
if os.Getenv("SKIP_KEY_PRESS") == "true" {
|
||||
Skip("This is a unix-terminal specific scenario, skipping")
|
||||
}
|
||||
|
||||
devSession.PressKey('p')
|
||||
}
|
||||
|
||||
_, _, _, err := devSession.WaitSync()
|
||||
Expect(err).Should(Succeed())
|
||||
|
||||
for _, p := range containerPorts {
|
||||
By(fmt.Sprintf("returning the right response when querying port forwarded for container port %d", p),
|
||||
func() {
|
||||
Eventually(func() string {
|
||||
return getServerResponse(p)
|
||||
}, 180, 10).Should(Equal("H3110 from Node.js Starter Application!"))
|
||||
devSession.PressKey('p')
|
||||
}
|
||||
var err error
|
||||
_, _, ports, err = devSession.WaitSync()
|
||||
Expect(err).Should(Succeed())
|
||||
})
|
||||
|
||||
It("should expose the endpoint on localhost", func() {
|
||||
By("updating the pod", func() {
|
||||
podName := commonVar.CliRunner.GetRunningPodNameByComponent(cmpName, commonVar.Project)
|
||||
bufferOutput := commonVar.CliRunner.Run("get", "pods", podName, "-o", "jsonpath='{.spec.containers[0].resources.requests.memory}'").Out.Contents()
|
||||
output := string(bufferOutput)
|
||||
Expect(output).To(ContainSubstring("1023Mi"))
|
||||
})
|
||||
|
||||
By("exposing the endpoint", func() {
|
||||
url := fmt.Sprintf("http://%s", ports["3000"])
|
||||
resp, err := http.Get(url)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
helper.MatchAllInOutput(string(body), []string{"Hello from Node.js Starter Application!"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
When("devfile has multiple endpoints", func() {
|
||||
BeforeEach(func() {
|
||||
if !podman {
|
||||
helper.Cmd("odo", "set", "project", commonVar.Project).ShouldPass()
|
||||
}
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project-with-multiple-endpoints"), commonVar.Context)
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-multiple-endpoints.yaml")).ShouldPass()
|
||||
})
|
||||
|
||||
When("running odo dev", func() {
|
||||
var devSession helper.DevSession
|
||||
var ports map[string]string
|
||||
BeforeEach(func() {
|
||||
opts := []string{}
|
||||
if manual {
|
||||
opts = append(opts, "--no-watch")
|
||||
}
|
||||
var err error
|
||||
devSession, _, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: opts,
|
||||
RunOnPodman: podman,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
devSession.Stop()
|
||||
devSession.WaitEnd()
|
||||
})
|
||||
|
||||
It("should expose all endpoints on localhost regardless of exposure", func() {
|
||||
getServerResponse := func(p int) string {
|
||||
resp, err := http.Get(fmt.Sprintf("http://%s", ports[strconv.Itoa(p)]))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return string(body)
|
||||
}
|
||||
containerPorts := []int{3000, 4567, 7890}
|
||||
|
||||
for _, p := range containerPorts {
|
||||
By(fmt.Sprintf("exposing a port targeting container port %d", p), func() {
|
||||
r := getServerResponse(p)
|
||||
helper.MatchAllInOutput(r, []string{"Hello from Node.js Starter Application!"})
|
||||
})
|
||||
}
|
||||
|
||||
if !podman {
|
||||
helper.ReplaceString("server.js", "Hello from Node.js", "H3110 from Node.js")
|
||||
|
||||
if manual {
|
||||
if os.Getenv("SKIP_KEY_PRESS") == "true" {
|
||||
Skip("This is a unix-terminal specific scenario, skipping")
|
||||
}
|
||||
|
||||
devSession.PressKey('p')
|
||||
}
|
||||
|
||||
_, _, _, err := devSession.WaitSync()
|
||||
Expect(err).Should(Succeed())
|
||||
|
||||
for _, p := range containerPorts {
|
||||
By(fmt.Sprintf("returning the right response when querying port forwarded for container port %d", p),
|
||||
func() {
|
||||
Eventually(func() string {
|
||||
return getServerResponse(p)
|
||||
}, 180, 10).Should(Equal("H3110 from Node.js Starter Application!"))
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
})...)
|
||||
}
|
||||
}
|
||||
|
||||
for _, devfileHandlerCtx := range []struct {
|
||||
@@ -732,7 +761,7 @@ ComponentSettings:
|
||||
var session helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -740,7 +769,7 @@ ComponentSettings:
|
||||
session.WaitEnd()
|
||||
})
|
||||
|
||||
It("should check if the env variable has a correct value", func() {
|
||||
It("3. should check if the env variable has a correct value", func() {
|
||||
envVars := commonVar.CliRunner.GetEnvsDevFileDeployment(devfileCmpName, "app", commonVar.Project)
|
||||
// check if the env variable has a correct value. This value was substituted from in devfile from variable
|
||||
Expect(envVars["FOO"]).To(Equal("bar"))
|
||||
@@ -751,7 +780,9 @@ ComponentSettings:
|
||||
var session helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil, "--var", "VALUE_TEST=baz")
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--var", "VALUE_TEST=baz"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -773,7 +804,9 @@ ComponentSettings:
|
||||
var err error
|
||||
err = helper.CreateFileWithContent(varfilename, "VALUE_TEST=baz")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session, _, _, _, err = helper.StartDevMode(nil, "--var-file", "vars.txt")
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--var-file", "vars.txt"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -797,7 +830,9 @@ ComponentSettings:
|
||||
_ = os.Setenv("VALUE_TEST", "baz")
|
||||
err = helper.CreateFileWithContent(varfilename, "VALUE_TEST")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session, _, _, _, err = helper.StartDevMode(nil, "--var-file", "vars.txt")
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"--var-file", "vars.txt"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -898,7 +933,7 @@ ComponentSettings:
|
||||
// Create a new directory
|
||||
helper.MakeDir(newDirPath)
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -967,7 +1002,7 @@ ComponentSettings:
|
||||
// Create a new directory
|
||||
helper.MakeDir(newDirPath)
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -1034,7 +1069,7 @@ ComponentSettings:
|
||||
fmt.Printf("the .gitignore file was not created, reason %v", err.Error())
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1100,7 +1135,7 @@ ComponentSettings:
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
})
|
||||
@@ -1140,7 +1175,7 @@ ComponentSettings:
|
||||
}
|
||||
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1176,7 +1211,7 @@ ComponentSettings:
|
||||
// reset clonePath and change the workdir accordingly, it should sync to project name
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "clonePath: webapp/", "# clonePath: webapp/")
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1207,7 +1242,7 @@ ComponentSettings:
|
||||
}
|
||||
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1238,7 +1273,7 @@ ComponentSettings:
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1268,7 +1303,7 @@ ComponentSettings:
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1340,7 +1375,7 @@ ComponentSettings:
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1378,7 +1413,9 @@ ComponentSettings:
|
||||
When("odo dev is running", func() {
|
||||
BeforeEach(func() {
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
session, sessionOut, sessionErr, ports, err = helper.StartDevMode([]string{"PODMAN_CMD=echo"})
|
||||
session, sessionOut, sessionErr, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
EnvVars: []string{"PODMAN_CMD=echo"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
It("should execute the composite apply commands successfully", func() {
|
||||
@@ -1464,7 +1501,9 @@ CMD ["npm", "start"]
|
||||
url = server.URL
|
||||
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "./Dockerfile", url)
|
||||
session, sessionOut, _, ports, err = helper.StartDevMode(env)
|
||||
session, sessionOut, _, ports, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
EnvVars: env,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -1539,7 +1578,7 @@ CMD ["npm", "start"]
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1576,7 +1615,7 @@ CMD ["npm", "start"]
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1613,7 +1652,7 @@ CMD ["npm", "start"]
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1652,7 +1691,7 @@ CMD ["npm", "start"]
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, stdout, stderr, _, err = helper.StartDevMode(nil)
|
||||
session, stdout, stderr, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -1717,7 +1756,7 @@ CMD ["npm", "start"]
|
||||
devfileHandlerCtx.devfileHandler(filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
}
|
||||
var err error
|
||||
session, stdout, stderr, _, err = helper.StartDevMode(nil)
|
||||
session, stdout, stderr, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -1793,7 +1832,7 @@ CMD ["npm", "start"]
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(commonVar.Context, "devfile.yaml"))
|
||||
helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "npm start", "npm starts")
|
||||
var err error
|
||||
session, _, initErr, _, err = helper.StartDevMode(nil)
|
||||
session, _, initErr, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -1833,7 +1872,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", devfileCmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "springboot", "devfile.yaml")).ShouldPass()
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), commonVar.Context)
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -2107,7 +2146,9 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "springboot", "devfile-registry.yaml")).ShouldPass()
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), commonVar.Context)
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil, "-v", "4")
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{
|
||||
CmdlineArgs: []string{"-v", "4"},
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -2214,7 +2255,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-MR-CL-CR.yaml")).ShouldPass()
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -2253,7 +2294,7 @@ CMD ["npm", "start"]
|
||||
|
||||
helper.ReplaceString("package.json", "node server.js", "node server/server.js")
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -2284,7 +2325,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass()
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
|
||||
session, _, errContents, _, err := helper.StartDevMode(nil)
|
||||
session, _, errContents, _, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
session.Stop()
|
||||
@@ -2306,7 +2347,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass()
|
||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
|
||||
|
||||
session, _, errContents, err := helper.StartDevMode(nil)
|
||||
session, _, errContents, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer session.Stop()
|
||||
helper.MatchAllInOutput(string(errContents), []string{"odo may not work as expected in the default project"})
|
||||
@@ -2327,7 +2368,7 @@ CMD ["npm", "start"]
|
||||
helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-multiple-endpoints.yaml")).ShouldPass()
|
||||
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -2400,7 +2441,7 @@ CMD ["npm", "start"]
|
||||
})
|
||||
|
||||
It("should run odo dev successfully (#5620)", func() {
|
||||
devSession, stdoutBytes, stderrBytes, _, err := helper.StartDevMode(nil)
|
||||
devSession, stdoutBytes, stderrBytes, _, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
defer devSession.Stop()
|
||||
const errorMessage = "Failed to create the component:"
|
||||
@@ -2435,7 +2476,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-multiple-endpoints.yaml")).ShouldPass()
|
||||
Expect(helper.VerifyFileExists(".odo/devstate.json")).To(BeFalse())
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -2463,7 +2504,7 @@ CMD ["npm", "start"]
|
||||
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-multiple-endpoints.yaml")).ShouldPass()
|
||||
Expect(helper.VerifyFileExists(".odo/devstate.json")).To(BeFalse())
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -2495,7 +2536,7 @@ CMD ["npm", "start"]
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-parent.yaml"), filepath.Join(commonVar.Context, "devfile-parent.yaml"))
|
||||
helper.CopyExample(filepath.Join("source", "nodejs"), commonVar.Context)
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
gitignorePath := filepath.Join(commonVar.Context, ".gitignore")
|
||||
@@ -2531,7 +2572,7 @@ CMD ["npm", "start"]
|
||||
BeforeEach(func() {
|
||||
helper.CopyExample(filepath.Join("source", "java-quarkus"), commonVar.Context)
|
||||
var err error
|
||||
devSession, stdout, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, stdout, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -2570,7 +2611,7 @@ CMD ["npm", "start"]
|
||||
var devSession helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
@@ -2796,7 +2837,7 @@ CMD ["npm", "start"]
|
||||
var devSession helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ var _ = Describe("odo devfile deploy command tests", func() {
|
||||
})
|
||||
|
||||
It("should run odo dev successfully", func() {
|
||||
session, _, _, _, err := helper.StartDevMode(nil)
|
||||
session, _, _, _, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session.Kill()
|
||||
session.WaitEnd()
|
||||
@@ -105,7 +105,7 @@ var _ = Describe("odo devfile deploy command tests", func() {
|
||||
|
||||
When("running and stopping odo dev", func() {
|
||||
BeforeEach(func() {
|
||||
session, _, _, _, err := helper.StartDevMode(nil)
|
||||
session, _, _, _, err := helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
session.Stop()
|
||||
session.WaitEnd()
|
||||
|
||||
@@ -101,7 +101,7 @@ var _ = Describe("odo list with devfile", func() {
|
||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-deploy.yaml"), path.Join(commonVar.Context, "devfile.yaml"))
|
||||
helper.Chdir(commonVar.Context)
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -214,7 +214,7 @@ var _ = Describe("odo list with devfile", func() {
|
||||
var devSession helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
@@ -241,7 +241,7 @@ var _ = Describe("odo list with devfile", func() {
|
||||
var devSession helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
|
||||
@@ -77,7 +77,7 @@ var _ = Describe("odo logs command tests", func() {
|
||||
var err error
|
||||
|
||||
BeforeEach(func() {
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// We need to wait for the pod deployed as a Kubernetes component
|
||||
Eventually(func() bool {
|
||||
@@ -175,7 +175,7 @@ var _ = Describe("odo logs command tests", func() {
|
||||
var devSession helper.DevSession
|
||||
var err error
|
||||
BeforeEach(func() {
|
||||
devSession, _, _, _, err = helper.StartDevMode(nil)
|
||||
devSession, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
helper.Cmd("odo", "deploy").AddEnv("PODMAN_CMD=echo").ShouldPass()
|
||||
Eventually(func() bool {
|
||||
|
||||
@@ -45,7 +45,7 @@ var _ = Describe("odo remove binding command tests", func() {
|
||||
var session helper.DevSession
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
session, _, _, _, err = helper.StartDevMode(nil)
|
||||
session, _, _, _, err = helper.StartDevMode(helper.DevSessionOpts{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
|
||||
Reference in New Issue
Block a user