From 10a6bb10870049c24133f4fee5bd7912c5c2ff7f Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Fri, 25 Mar 2022 11:31:23 +0530 Subject: [PATCH] Fix CI failure --- tests/helper/helper_filesystem.go | 12 ------------ tests/integration/devfile/cmd_devfile_init_test.go | 7 +++---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/helper/helper_filesystem.go b/tests/helper/helper_filesystem.go index 714edb75c2e..e3fb1cd9e79 100644 --- a/tests/helper/helper_filesystem.go +++ b/tests/helper/helper_filesystem.go @@ -274,18 +274,6 @@ func VerifyFileExists(filename string) bool { return !info.IsDir() } -// VerifyFilesExist receives an array of paths to files, and returns whether -// or not they all exist. If any one of the expected files doesn't exist, it -// returns false -func VerifyFilesExist(path string, files []string) bool { - for _, f := range files { - if !VerifyFileExists(filepath.Join(path, f)) { - return false - } - } - return true -} - // ReplaceDevfileField replaces the value of a given field in a specified // devfile. // Currently only the first match of the field is replaced. i.e if the diff --git a/tests/integration/devfile/cmd_devfile_init_test.go b/tests/integration/devfile/cmd_devfile_init_test.go index 967f0edb523..38f287fd632 100644 --- a/tests/integration/devfile/cmd_devfile_init_test.go +++ b/tests/integration/devfile/cmd_devfile_init_test.go @@ -148,8 +148,7 @@ var _ = Describe("odo devfile init command tests", func() { When("running odo init with a devfile that has a subDir starter project", func() { BeforeEach(func() { - helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), commonVar.Context) - helper.Cmd("odo", "init", "--name", "aname", "--devfile-path", helper.GetExamplePath("source", "devfiles", "springboot", "devfile-with-subDir.yaml"), "--starter", "spingbootproject").ShouldPass() + helper.Cmd("odo", "init", "--name", "aname", "--devfile-path", helper.GetExamplePath("source", "devfiles", "springboot", "devfile-with-subDir.yaml"), "--starter", "springbootproject").ShouldPass() }) It("should successfully extract the project in the specified subDir path", func() { @@ -187,13 +186,13 @@ var _ = Describe("odo devfile init command tests", func() { It("should successfully run odo init for devfile with starter project from the specified branch", func() { helper.Cmd("odo", "init", "--name", "aname", "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-branch.yaml"), "--starter", "nodejs-starter").ShouldPass() expectedFiles := []string{"package.json", "package-lock.json", "README.md", "devfile.yaml", "test"} - Expect(helper.VerifyFilesExist(commonVar.Context, expectedFiles)).To(Equal(true)) + Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements(expectedFiles)) }) It("should successfully run odo init for devfile with starter project from the specified tag", func() { helper.Cmd("odo", "init", "--name", "aname", "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-tag.yaml"), "--starter", "nodejs-starter").ShouldPass() expectedFiles := []string{"package.json", "package-lock.json", "README.md", "devfile.yaml", "app"} - Expect(helper.VerifyFilesExist(commonVar.Context, expectedFiles)).To(Equal(true)) + Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements(expectedFiles)) }) When("running odo init from a directory with sources", func() { BeforeEach(func() {