Skip to content

Commit

Permalink
Commenting out test for parent support
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkrout committed Aug 21, 2020
1 parent 7c62c57 commit 2ddf0a6
Showing 1 changed file with 57 additions and 61 deletions.
118 changes: 57 additions & 61 deletions tests/integration/devfile/cmd_devfile_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ package devfile

import (
"fmt"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/openshift/odo/pkg/util"

"github.com/openshift/odo/tests/helper"
"github.com/openshift/odo/tests/integration/devfile/utils"

Expand Down Expand Up @@ -760,79 +756,79 @@ var _ = Describe("odo devfile push command tests", func() {

})

Context("Handle devfiles with parent", func() {
var server *http.Server
var freePort int
var parentTmpFolder string
// Context("Handle devfiles with parent", func() {
// var server *http.Server
// var freePort int
// var parentTmpFolder string

var _ = BeforeSuite(func() {
// get a free port
var err error
freePort, err = util.HTTPGetFreePort()
Expect(err).NotTo(HaveOccurred())
// var _ = BeforeSuite(func() {
// // get a free port
// var err error
// freePort, err = util.HTTPGetFreePort()
// Expect(err).NotTo(HaveOccurred())

// move the parent devfiles to a tmp folder
parentTmpFolder = helper.CreateNewContext()
helper.CopyExample(filepath.Join("source", "devfiles", "parentSupport"), parentTmpFolder)
// update the port in the required devfile with the free port
helper.ReplaceString(filepath.Join(parentTmpFolder, "devfile-middle-layer.yaml"), "(-1)", strconv.Itoa(freePort))
// // move the parent devfiles to a tmp folder
// parentTmpFolder = helper.CreateNewContext()
// helper.CopyExample(filepath.Join("source", "devfiles", "parentSupport"), parentTmpFolder)
// // update the port in the required devfile with the free port
// helper.ReplaceString(filepath.Join(parentTmpFolder, "devfile-middle-layer.yaml"), "(-1)", strconv.Itoa(freePort))

// start the server and serve from the tmp folder of the devfiles
server = helper.HttpFileServer(freePort, parentTmpFolder)
// // start the server and serve from the tmp folder of the devfiles
// server = helper.HttpFileServer(freePort, parentTmpFolder)

// wait for the server to be respond with the desired result
helper.HttpWaitFor("http://localhost:"+strconv.Itoa(freePort), "devfile", 10, 1)
})
// // wait for the server to be respond with the desired result
// helper.HttpWaitFor("http://localhost:"+strconv.Itoa(freePort), "devfile", 10, 1)
// })

var _ = AfterSuite(func() {
helper.DeleteDir(parentTmpFolder)
err := server.Close()
Expect(err).To(BeNil())
})
// var _ = AfterSuite(func() {
// helper.DeleteDir(parentTmpFolder)
// err := server.Close()
// Expect(err).To(BeNil())
// })

It("should handle a devfile with a parent and add a extra command", func() {
utils.ExecPushToTestParent(context, cmpName, namespace)
podName := cliRunner.GetRunningPodNameByComponent(cmpName, namespace)
listDir := cliRunner.ExecListDir(podName, namespace, "/project/")
Expect(listDir).To(ContainSubstring("blah.js"))
})
// It("should handle a devfile with a parent and add a extra command", func() {
// utils.ExecPushToTestParent(context, cmpName, namespace)
// podName := cliRunner.GetRunningPodNameByComponent(cmpName, namespace)
// listDir := cliRunner.ExecListDir(podName, namespace, "/project/")
// Expect(listDir).To(ContainSubstring("blah.js"))
// })

It("should handle a parent and override/append it's envs", func() {
utils.ExecPushWithParentOverride(context, cmpName, namespace, freePort)
// It("should handle a parent and override/append it's envs", func() {
// utils.ExecPushWithParentOverride(context, cmpName, namespace, freePort)

envMap := cliRunner.GetEnvsDevFileDeployment(cmpName, namespace)
// envMap := cliRunner.GetEnvsDevFileDeployment(cmpName, namespace)

value, ok := envMap["ODO_TEST_ENV_0"]
Expect(ok).To(BeTrue())
Expect(value).To(Equal("ENV_VALUE_0"))
// value, ok := envMap["ODO_TEST_ENV_0"]
// Expect(ok).To(BeTrue())
// Expect(value).To(Equal("ENV_VALUE_0"))

value, ok = envMap["ODO_TEST_ENV_1"]
Expect(ok).To(BeTrue())
Expect(value).To(Equal("ENV_VALUE_1_1"))
})
// value, ok = envMap["ODO_TEST_ENV_1"]
// Expect(ok).To(BeTrue())
// Expect(value).To(Equal("ENV_VALUE_1_1"))
// })

It("should handle a multi layer parent", func() {
utils.ExecPushWithMultiLayerParent(context, cmpName, namespace, freePort)
// It("should handle a multi layer parent", func() {
// utils.ExecPushWithMultiLayerParent(context, cmpName, namespace, freePort)

podName := cliRunner.GetRunningPodNameByComponent(cmpName, namespace)
listDir := cliRunner.ExecListDir(podName, namespace, "/project")
helper.MatchAllInOutput(listDir, []string{"blah.js", "new-blah.js"})
// podName := cliRunner.GetRunningPodNameByComponent(cmpName, namespace)
// listDir := cliRunner.ExecListDir(podName, namespace, "/project")
// helper.MatchAllInOutput(listDir, []string{"blah.js", "new-blah.js"})

envMap := cliRunner.GetEnvsDevFileDeployment(cmpName, namespace)
// envMap := cliRunner.GetEnvsDevFileDeployment(cmpName, namespace)

value, ok := envMap["ODO_TEST_ENV_1"]
Expect(ok).To(BeTrue())
Expect(value).To(Equal("ENV_VALUE_1_1"))
// value, ok := envMap["ODO_TEST_ENV_1"]
// Expect(ok).To(BeTrue())
// Expect(value).To(Equal("ENV_VALUE_1_1"))

value, ok = envMap["ODO_TEST_ENV_2"]
Expect(ok).To(BeTrue())
Expect(value).To(Equal("ENV_VALUE_2"))
// value, ok = envMap["ODO_TEST_ENV_2"]
// Expect(ok).To(BeTrue())
// Expect(value).To(Equal("ENV_VALUE_2"))

value, ok = envMap["ODO_TEST_ENV_3"]
Expect(ok).To(BeTrue())
Expect(value).To(Equal("ENV_VALUE_3"))
// value, ok = envMap["ODO_TEST_ENV_3"]
// Expect(ok).To(BeTrue())
// Expect(value).To(Equal("ENV_VALUE_3"))

})
})
// })
// })

})

0 comments on commit 2ddf0a6

Please sign in to comment.