Skip to content

Commit

Permalink
reduce test make targets, organize test file structure (#5931)
Browse files Browse the repository at this point in the history
* reduce test make targets, organize test file structure

Signed-off-by: anandrkskd <[email protected]>

* remove report collection

Signed-off-by: anandrkskd <[email protected]>
  • Loading branch information
anandrkskd authored Jul 13, 2022
1 parent 2ae27e9 commit c7f3f3b
Show file tree
Hide file tree
Showing 33 changed files with 71 additions and 421 deletions.
9 changes: 3 additions & 6 deletions .ibm/pipelines/kubernetes-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ ibmcloud target -r "${IBM_REGION}"
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin

cleanup_namespaces

export SKIP_USER_LOGIN_TESTS=true
(
set -e
make install
make test-integration-devfile
make test-interactive
make test-e2e-devfile
make test-cmd-project
make test-generic
make test-integration
make test-e2e
) |& tee "/tmp/${LOGFILE}"

RESULT=${PIPESTATUS[0]}
Expand Down
6 changes: 1 addition & 5 deletions .ibm/pipelines/openshift-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ cleanup_namespaces
set -e
make install
make test-integration
make test-interactive
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
make test-e2e-devfile
make test-e2e
) |& tee "/tmp/${LOGFILE}"

RESULT=${PIPESTATUS[0]}
Expand Down
8 changes: 1 addition & 7 deletions .ibm/pipelines/windows-test-script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ function Run-Test {
Shout "Create Binary"
make install
Shout "Running test"
make test-integration-devfile | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-integration | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-cmd-login-logout | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-cmd-project | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-e2e-devfile | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
make test-e2e | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE

Pop-Location
Expand Down
126 changes: 7 additions & 119 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,122 +164,6 @@ test:
test-windows:
go test $(UNIT_TEST_ARGS) $(PKGS)

.PHONY: test-generic
test-generic: install ## Run generic integration tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo generic" tests/integration/

.PHONY: test-cmd-login-logout
test-cmd-login-logout: install ## Run odo login and logout tests
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo login and logout command tests" tests/integration/loginlogout/

.PHONY: test-cmd-link-unlink-4-cluster
test-cmd-link-unlink-4-cluster: install ## Run link and unlink commnad tests against 4.x cluster
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo link and unlink commnad tests" tests/integration/

.PHONY: test-cmd-project
test-cmd-project: install ## Run odo project command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo project command tests" tests/integration/project/

.PHONY: test-cmd-pref-config
test-cmd-pref-config: install ## Run odo preference and config command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo preference and config command tests" tests/integration/

.PHONY: test-plugin-handler
test-plugin-handler: install ## Run odo plugin handler tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo plugin functionality" tests/integration/

.PHONY: test-cmd-devfile-list
test-cmd-devfile-list: install ## Run odo list devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo list with devfile" tests/integration/devfile/

.PHONY: test-cmd-devfile-init
test-cmd-devfile-init: install ## Run odo init devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile init command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-push
test-cmd-devfile-push: install ## Run odo push devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile push command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-exec
test-cmd-devfile-exec: install ## Run odo exec devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile exec command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-status
test-cmd-devfile-status: install ## Run odo status devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile status command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-watch
test-cmd-devfile-watch: install ## Run odo devfile watch command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile watch command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-app
test-cmd-devfile-app: install ## Run odo devfile app command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile app command tests" tests/integration/devfile/

.PHONY: test-cmd-delete
test-cmd-delete: install ## Run odo delete command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo delete command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-registry
test-cmd-devfile-registry: install ## Run odo devfile registry command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile registry command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-test
test-cmd-devfile-test: install ## Run odo devfile test command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile test command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-debug
test-cmd-devfile-debug: install ## Run odo debug devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile debug command tests" tests/integration/devfile/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo devfile debug command serial tests" tests/integration/devfile/debug/

.PHONY: test-cmd-devfile-storage
test-cmd-devfile-storage: install ## Run odo storage devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile storage command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-log
test-cmd-devfile-log: install ## Run odo log devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile log command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-env
test-cmd-devfile-env: install ## Run odo env devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile env command tests" tests/integration/devfile/

.PHONY: test-cmd-devfile-config
test-cmd-devfile-config: install ## Run odo config devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile config command tests" tests/integration/devfile/

.PHONY: test-cmd-watch
test-cmd-watch: install ## Run odo watch command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo watch command tests" tests/integration/

.PHONY: test-cmd-debug
test-cmd-debug: install ## Run odo debug command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo debug command tests" tests/integration/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo debug command serial tests" tests/integration/debug/

# Service, link and login/logout command tests are not the part of this test run
.PHONY: test-integration
test-integration: install ## Run command's integration tests irrespective of service catalog status in the cluster.
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/

.PHONY: test-interactive
test-interactive: install ## Run integration interactive tests
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/interactive/

.PHONY: test-integration-devfile
test-integration-devfile: install ## Run devfile integration tests
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/devfile/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) tests/integration/devfile/debug/

.PHONY: test-e2e-devfile
test-e2e-devfile: install ## Run devfile e2e tests: odo devfile supported tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile supported tests" tests/e2escenarios/

.PHONY: test-e2e-all
test-e2e-all: install ## Run all e2e test scenarios
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/e2escenarios/

# run make cross before this!
.PHONY: packages
packages: ## create deb and rpm packages using fpm in ./dist/pkgs/
Expand All @@ -298,6 +182,10 @@ vendor-update: ## Update vendoring
openshiftci-presubmit-unittests:
./scripts/openshiftci-presubmit-unittests.sh

.PHONY: test-cmd-devfile-describe
test-cmd-devfile-describe: install
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile describe command tests" tests/integration/devfile/
.PHONY: test-integration
test-integration:
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration

.PHONY: test-e2e
test-e2e:
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/e2escenarios
1 change: 0 additions & 1 deletion scripts/openshiftci-Nightly-SBO-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ oc whoami
# Operatorhub integration tests
make test-operator-hub

cp -r tests/reports $ARTIFACT_DIR

oc logout
10 changes: 2 additions & 8 deletions scripts/openshiftci-periodic-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@ oc whoami

# Integration tests
make test-integration || error=true
make test-integration-devfile || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true

# Interactive tests
make test-interactive || error=true

# E2e tests
make test-e2e-all || error=true
make test-e2e || error=true

if [ $error ]; then
exit -1
fi

cp -r reports tests/reports $ARTIFACT_DIR


oc logout
68 changes: 0 additions & 68 deletions scripts/openshiftci-presubmit-all-tests-old.sh

This file was deleted.

20 changes: 3 additions & 17 deletions scripts/openshiftci-presubmit-all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,25 @@ oc whoami
if [ "${ARCH}" == "s390x" ]; then
# Integration tests
make test-integration
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
# E2e tests
make test-e2e-all
make test-e2e
elif [ "${ARCH}" == "ppc64le" ]; then
# Integration tests
make test-integration
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
# E2e tests
make test-e2e-all
make test-e2e
else
# Integration tests
make test-integration || error=true
make test-interactive || error=true
make test-integration-devfile || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true

# Interactive tests
make test-interactive || error=true

# E2e tests
make test-e2e-all || error=true
make test-e2e || error=true

# Fail the build if there is any error while test execution
if [ $error ]; then
exit -1
fi
fi

cp -r reports tests/reports $ARTIFACT_DIR

oc logout
32 changes: 32 additions & 0 deletions tests/helper/odo_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,35 @@ func GetDevfileComponents(devfilePath, componentName string) []v1alpha2.Componen
Expect(err).ToNot(HaveOccurred())
return components
}

type OdoV2Watch struct {
CmpName string
StringsToBeMatched []string
StringsNotToBeMatched []string
FolderToCheck string
SrcType string
}

// VerifyContainerSyncEnv verifies the sync env in the container
func VerifyContainerSyncEnv(podName, containerName, namespace, projectSourceValue, projectsRootValue string, cliRunner CliRunner) {
envProjectsRoot, envProjectSource := "PROJECTS_ROOT", "PROJECT_SOURCE"
projectSourceMatched, projectsRootMatched := false, false

envNamesAndValues := cliRunner.GetContainerEnv(podName, "runtime", namespace)
envNamesAndValuesArr := strings.Fields(envNamesAndValues)

for _, envNamesAndValues := range envNamesAndValuesArr {
envNameAndValueArr := strings.Split(envNamesAndValues, ":")

if envNameAndValueArr[0] == envProjectSource && strings.Contains(envNameAndValueArr[1], projectSourceValue) {
projectSourceMatched = true
}

if envNameAndValueArr[0] == envProjectsRoot && strings.Contains(envNameAndValueArr[1], projectsRootValue) {
projectsRootMatched = true
}
}

Expect(projectSourceMatched).To(Equal(true))
Expect(projectsRootMatched).To(Equal(true))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package devfile
package integration

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package devfile
package integration

import (
"path/filepath"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package devfile
package integration

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package devfile
package integration

import (
"os"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package devfile
package integration

import (
"fmt"
Expand Down
Loading

0 comments on commit c7f3f3b

Please sign in to comment.