Skip to content
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
2 changes: 2 additions & 0 deletions test/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
: "${TEST_REGEX:=smoke}"
# Regex to skip Test Cases
: "${SKIP_REGEX:=}"
# Set to DEBUG_RUN:=True to skip tear down of test environment in case of test failure
: "${DEBUG_RUN:=False}"

# Docker registry to use to push the test images to and pull from in the cluster
if [ -z "${PRIVATE_REGISTRY}" ]; then
Expand Down
7 changes: 6 additions & 1 deletion test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ if [[ -z "${TEST_TO_SKIP}" ]]; then
echo "TEST_TO_SKIP not set. Changing to default"
export TEST_TO_SKIP="${SKIP_REGEX}"
fi
echo "Skipping following test :: ${TEST_TO_SKIP}"

if [[ -z "${DEBUG}" ]]; then
echo "DEBUG not set. Changing to default"
export DEBUG="${DEBUG_RUN}"
fi

echo "Skipping following test :: ${TEST_TO_SKIP}"

# Running only smoke test cases by default or value passed through TEST_FOCUS env variable. To run different test packages add/remove path from focus argument or TEST_FOCUS variable
ginkgo -v -progress -r -keepGoing -nodes=${CLUSTER_NODES} --noisyPendings=false --reportPassed --focus="${TEST_TO_RUN}" --skip="${TEST_TO_SKIP}" ${topdir}/test/ -- -commit-hash=${COMMIT_HASH} -operator-image=${PRIVATE_SPLUNK_OPERATOR_IMAGE} -splunk-image=${PRIVATE_SPLUNK_ENTERPRISE_IMAGE}
2 changes: 1 addition & 1 deletion test/testenv/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (d *Deployment) popCleanupFunc() (cleanupFunc, error) {

// Teardown teardowns the deployment resources
func (d *Deployment) Teardown() error {
if d.testenv.SkipTeardown {
if d.testenv.SkipTeardown && d.testenv.debug == "True" {
d.testenv.Log.Info("deployment teardown is skipped!\n")
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion test/testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ type TestEnv struct {
kubeClient client.Client
Log logr.Logger
cleanupFuncs []cleanupFunc
debug string
}

func init() {
Expand Down Expand Up @@ -194,6 +195,7 @@ func NewTestEnv(name, commitHash, operatorImage, splunkImage, licenseFilePath st
licenseCMName: envName,
licenseFilePath: licenseFilePath,
s3IndexSecret: "splunk-s3-index-" + envName,
debug: os.Getenv("DEBUG"),
}

testenv.Log = logf.Log.WithValues("testenv", testenv.name)
Expand Down Expand Up @@ -294,7 +296,7 @@ func (testenv *TestEnv) setup() error {
// Teardown cleanup the resources use in this testenv
func (testenv *TestEnv) Teardown() error {

if testenv.SkipTeardown {
if testenv.SkipTeardown && testenv.debug == "True" {
testenv.Log.Info("testenv teardown is skipped!\n")
return nil
}
Expand Down