Skip to content

Commit

Permalink
Run service test specs in parallel (#1839)
Browse files Browse the repository at this point in the history
* Run service test specs in parallel

* Updated doc

* Updated doc
  • Loading branch information
amitkrout authored and openshift-merge-robot committed Jun 26, 2019
1 parent 0f2b414 commit 5d96478
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ test-source-e2e:
# Run service catalog e2e tests
.PHONY: test-service-e2e
test-service-e2e:
go test -v github.com/openshift/odo/tests/integration --ginkgo.focus="odoServiceE2e" -ginkgo.slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -ginkgo.v -timeout $(TIMEOUT)
ginkgo -v -nodes=$(TEST_EXEC_NODES) -focus="odoServiceE2e" slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -randomizeAllSpecs tests/integration/ -timeout $(TIMEOUT)

# Run link e2e tests
.PHONY: test-link-e2e
Expand Down
14 changes: 14 additions & 0 deletions docs/development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ $ make test-json-format-output
----
+

Run service command integration test
+
----
$ make test-service-e2e
----
+

* To run the test sequentially or on single ginkgo test node use enviornment variable `TEST_EXEC_NODES`:
+
Run component command integration test
Expand Down Expand Up @@ -240,6 +247,13 @@ $ make test-json-format-output TEST_EXEC_NODES=1
----
+

Run service command integration test
+
----
$ make test-service-e2e TEST_EXEC_NODES=1
----
+

* For the entire integration test suite use:
+
----
Expand Down
37 changes: 21 additions & 16 deletions tests/integration/service_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"os"
"path/filepath"
"strings"
"time"
Expand All @@ -18,32 +19,36 @@ var _ = Describe("odoServiceE2e", func() {

// current directory and project (before eny test is run) so it can restored after all testing is done
var originalDir string
var originalProject 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() {
BeforeEach(func() {
SetDefaultEventuallyTimeout(10 * time.Minute)
oc = helper.NewOcRunner("oc")
project = helper.CreateRandProject()
context = helper.CreateNewContext()
originalDir = helper.Getwd()
originalProject = oc.GetCurrentProject()
helper.Chdir(context)
oc.SwitchProject(project)
})

// Clean up after the test
// This is run after every Spec (It)
var _ = AfterEach(func() {
helper.Chdir(originalDir)
oc.SwitchProject(originalProject)
helper.DeleteProject(project)
helper.DeleteDir(context)
Context("when running help for service command", func() {
It("should display the help", func() {
appHelp := helper.CmdShouldPass("odo", "service", "-h")
Expect(appHelp).To(ContainSubstring("Perform service catalog operations"))
})
})

Context("odo service create with a spring boot application", func() {
Context("When creating with a spring boot application", func() {
JustBeforeEach(func() {
project = helper.CreateRandProject()
context = helper.CreateNewContext()
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
originalDir = helper.Getwd()
helper.Chdir(context)
})
JustAfterEach(func() {
helper.DeleteProject(project)
helper.DeleteDir(context)
helper.Chdir(originalDir)
os.Unsetenv("GLOBALODOCONFIG")
})
It("should be able to create postgresql and link it with springboot", func() {
oc.ImportJavaIsToNspace(project)
helper.CopyExample(filepath.Join("source", "openjdk-sb-postgresql"), context)
Expand Down

0 comments on commit 5d96478

Please sign in to comment.