From 78797becbe0cc745c05eb8606638213d894630bf Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 17 Jun 2019 11:34:00 +0530 Subject: [PATCH 1/3] Run watch command test in parallel --- tests/integration/cmd_watch_test.go | 51 +++++++++++++++++++++++ tests/integration/watch_test.go | 64 ----------------------------- 2 files changed, 51 insertions(+), 64 deletions(-) create mode 100644 tests/integration/cmd_watch_test.go delete mode 100644 tests/integration/watch_test.go diff --git a/tests/integration/cmd_watch_test.go b/tests/integration/cmd_watch_test.go new file mode 100644 index 00000000000..24b6683f3f8 --- /dev/null +++ b/tests/integration/cmd_watch_test.go @@ -0,0 +1,51 @@ +package integration + +import ( + "os" + "path/filepath" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "github.com/openshift/odo/tests/helper" +) + +var _ = Describe("odoWatchE2e", func() { + var project string + var context string + + // Setup up state for each test spec + // create new project (not set as active) and new context directory for each test spec + // This is before every spec (It) + BeforeEach(func() { + SetDefaultEventuallyTimeout(10 * time.Minute) + project = helper.CreateRandProject() + context = helper.CreateNewContext() + os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) + }) + + // Clean up after the test + // This is run after every Spec (It) + AfterEach(func() { + helper.DeleteProject(project) + helper.DeleteDir(context) + os.Unsetenv("GLOBALODOCONFIG") + }) + + Context("when running help for watch command", func() { + It("should display the help", func() { + appHelp := helper.CmdShouldPass("odo", "watch", "-h") + Expect(appHelp).To(ContainSubstring("Watch for changes")) + }) + }) + + Context("when executing watch without pushing the component", func() { + It("should fail", func() { + helper.CopyExample(filepath.Join("source", "nodejs"), context) + helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project, "--context", context) + output := helper.CmdShouldFail("odo", "watch", "--context", context) + Expect(output).To(ContainSubstring("component does not exist. Please use `odo push` to create you component")) + }) + }) +}) diff --git a/tests/integration/watch_test.go b/tests/integration/watch_test.go deleted file mode 100644 index f44aae56dd4..00000000000 --- a/tests/integration/watch_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package integration - -import ( - "path/filepath" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/openshift/odo/tests/helper" -) - -var _ = Describe("odoWatchE2e", func() { - var project string - var context string - - // current directory and project (before eny test is run) so it can restored after all testing is done - var originalDir string - //var oc helper.OcRunner - - // Setup up state for each test spec - // create new project (not set as active) and new context directory for each test spec - // This is before every spec (It) - var _ = BeforeEach(func() { - SetDefaultEventuallyTimeout(10 * time.Minute) - //oc = helper.NewOcRunner("oc") - project = helper.CreateRandProject() - context = helper.CreateNewContext() - }) - - // Clean up after the test - // This is run after every Spec (It) - var _ = AfterEach(func() { - helper.DeleteProject(project) - helper.DeleteDir(context) - }) - - //new clean project and context for each test - var _ = Context("when component is in the current directory", func() { - - // we will be testing components that are created from the current directory - // switch to the clean context dir before each test - var _ = JustBeforeEach(func() { - originalDir = helper.Getwd() - helper.Chdir(context) - }) - - // go back to original directory after each test - var _ = JustAfterEach(func() { - helper.Chdir(originalDir) - }) - - var _ = Context("when --project flag is used", func() { - It("odo watch fail when component not pushed", func() { - - helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project) - output := helper.CmdShouldFail("odo", "watch") - Expect(output).To(ContainSubstring("component does not exist. Please use `odo push` to create you component")) - }) - }) - }) - -}) From 8a193d7413eded0d1cdc8c7a6be2c38e19742166 Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 17 Jun 2019 13:21:14 +0530 Subject: [PATCH 2/3] Updated Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc92a234dcd..832cd6b963e 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ test-link-e2e: # Run watch e2e tests .PHONY: test-watch-e2e test-watch-e2e: - go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoWatchE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT) + ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoWatchE2e" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT) # Run storage command integration tests .PHONY: test-cmd-storage From 8a0774ea26f4f42770041df3719e4b56f7ceabc7 Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 24 Jun 2019 16:05:57 +0530 Subject: [PATCH 3/3] Updated doc --- docs/development.adoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/development.adoc b/docs/development.adoc index 45b4b741a6f..d70563c97ed 100644 --- a/docs/development.adoc +++ b/docs/development.adoc @@ -189,6 +189,13 @@ $ make test-cmd-storage ---- + +Run watch command integration test ++ +---- +$ make test-watch-e2e +---- ++ + * To run the test sequentially or on single ginkgo test node use enviornment variable `TEST_EXEC_NODES`: + Run component command integration test @@ -212,6 +219,13 @@ $ make test-cmd-storage TEST_EXEC_NODES=1 ---- + +Run watch command integration test ++ +---- +$ make test-watch-e2e TEST_EXEC_NODES=1 +---- ++ + * For the entire integration test suite use: + ----