Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running spec parallelly for clean test template #1759

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
install:
- make goget-tools
script:
- export PATH="$PATH:$GOPATH/bin"
- make bin
- make validate
- make test-coverage
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ DEBUG_BUILD_FLAGS := -ldflags="$(COMMON_FLAGS)"
FILES := odo dist
TIMEOUT ?= 1800s

# Env variable TEST_EXEC_NODES is used to pass spec execution type
# (parallel or sequential) for ginkgo tests. To run the specs sequentially use
# TEST_EXEC_NODES=1, otherwise by default the specs are run in parallel on 4 ginkgo test node.
# NOTE: Any TEST_EXEC_NODES value greater than one runs the spec in parallel
# on the same number of ginkgo test nodes.
TEST_EXEC_NODES ?= 4

# Slow spec threshold for ginkgo tests. After this time (in second), ginkgo marks test as slow
SLOW_SPEC_THRESHOLD := 120

Expand Down Expand Up @@ -59,6 +66,7 @@ goget-tools:
# go get -u golang.org/x/lint/golint
go get -u github.com/mitchellh/gox
go get github.com/frapposelli/wwhrd
go get -u github.com/onsi/ginkgo/ginkgo

# Run unit tests and collect coverage
.PHONY: test-coverage
Expand Down
4 changes: 3 additions & 1 deletion scripts/openshiftci-presubmit-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export CI="openshift"
export TIMEOUT="30m"
make configure-installer-tests-cluster
make bin
export PATH="$PATH:$(pwd)"
mkdir -p $GOPATH/bin
go get -u github.com/onsi/ginkgo/ginkgo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds it to just OpenShift-CI. It won't be needed on travis?
We have make goget-tools that should be used for this.

Copy link
Contributor Author

@amitkrout amitkrout Jun 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export PATH="$PATH:$(pwd):$GOPATH/bin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why adding $(pwd)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in beginning when the script was created, so i could not analyze the intention of keeping it.

Anyway i do not see any valid reason to keep it. Will remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I haven't noticed that it was there before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(pwd) is needed in the PATH as we are not copying odo to /usr/bin

export CUSTOM_HOMEDIR="/tmp/artifacts"
make test-generic
make test-odo-login-e2e
Expand Down
11 changes: 5 additions & 6 deletions tests/template/template_cleantest_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package template

import (
"os"
"path/filepath"
"time"

Expand All @@ -20,10 +21,7 @@ var _ = Describe("Example of a clean test", 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
// path to odo binary
//var odo string

BeforeEach(func() {
// Set default timeout for Eventually assertions
Expand All @@ -33,15 +31,16 @@ var _ = Describe("Example of a clean test", func() {
// initialize oc runner
// right now it uses oc binary, but we should convert it to client-go
oc = helper.NewOcRunner("oc")
//odo = "odo"

project = helper.CreateRandProject()
context = helper.CreateNewContext()
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
project = helper.CreateRandProject()

})

AfterEach(func() {
helper.DeleteProject(project)
helper.DeleteDir(context)
os.Unsetenv("GLOBALODOCONFIG")
})

var _ = Context("when component is in the current directory", func() {
Expand Down