From c7f3f3b1d1b47027c142237e443e9c14ac2e1734 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Wed, 13 Jul 2022 11:02:11 +0530 Subject: [PATCH] reduce test make targets, organize test file structure (#5931) * reduce test make targets, organize test file structure Signed-off-by: anandrkskd * remove report collection Signed-off-by: anandrkskd --- .ibm/pipelines/kubernetes-tests.sh | 9 +- .ibm/pipelines/openshift-tests.sh | 6 +- .ibm/pipelines/windows-test-script.ps1 | 8 +- Makefile | 126 +----------------- scripts/openshiftci-Nightly-SBO-tests.sh | 1 - scripts/openshiftci-periodic-tests.sh | 10 +- .../openshiftci-presubmit-all-tests-old.sh | 68 ---------- scripts/openshiftci-presubmit-all-tests.sh | 20 +-- tests/helper/odo_utils.go | 32 +++++ .../{devfile => }/cmd_add_binding_test.go | 2 +- .../{devfile => }/cmd_analyze_test.go | 2 +- .../{devfile => }/cmd_delete_test.go | 2 +- .../cmd_describe_component_test.go | 2 +- .../cmd_describe_list_binding_test.go | 2 +- .../{devfile => }/cmd_dev_debug_test.go | 2 +- .../integration/{devfile => }/cmd_dev_test.go | 11 +- .../cmd_devfile_build_images_test.go | 2 +- .../{devfile => }/cmd_devfile_deploy_test.go | 2 +- .../{devfile => }/cmd_devfile_init_test.go | 2 +- .../{devfile => }/cmd_devfile_list_test.go | 2 +- .../cmd_devfile_registry_test.go | 2 +- .../{devfile => }/cmd_logs_test.go | 2 +- .../{devfile => }/cmd_remove_binding_test.go | 2 +- .../devfile/debug/debug_suite_test.go | 11 -- .../integration/devfile/devfile_suite_test.go | 11 -- tests/integration/devfile/utils/utils.go | 41 ------ .../interactive_add_binding_test.go} | 2 +- .../interactive_deploy_test.go} | 2 +- .../interactive_dev_test.go} | 2 +- .../interactive_init_test.go} | 2 +- tests/integration/project/cmd_project_test.go | 78 ----------- .../integration/project/project_suite_test.go | 11 -- tests/interactive/interactive_suit_test.go | 15 --- 33 files changed, 71 insertions(+), 421 deletions(-) delete mode 100755 scripts/openshiftci-presubmit-all-tests-old.sh rename tests/integration/{devfile => }/cmd_add_binding_test.go (99%) rename tests/integration/{devfile => }/cmd_analyze_test.go (98%) rename tests/integration/{devfile => }/cmd_delete_test.go (99%) rename tests/integration/{devfile => }/cmd_describe_component_test.go (99%) rename tests/integration/{devfile => }/cmd_describe_list_binding_test.go (99%) rename tests/integration/{devfile => }/cmd_dev_debug_test.go (99%) rename tests/integration/{devfile => }/cmd_dev_test.go (99%) rename tests/integration/{devfile => }/cmd_devfile_build_images_test.go (99%) rename tests/integration/{devfile => }/cmd_devfile_deploy_test.go (99%) rename tests/integration/{devfile => }/cmd_devfile_init_test.go (99%) rename tests/integration/{devfile => }/cmd_devfile_list_test.go (99%) rename tests/integration/{devfile => }/cmd_devfile_registry_test.go (99%) rename tests/integration/{devfile => }/cmd_logs_test.go (99%) rename tests/integration/{devfile => }/cmd_remove_binding_test.go (98%) delete mode 100644 tests/integration/devfile/debug/debug_suite_test.go delete mode 100644 tests/integration/devfile/devfile_suite_test.go delete mode 100644 tests/integration/devfile/utils/utils.go rename tests/{interactive/cmd_add_binding_test.go => integration/interactive_add_binding_test.go} (99%) rename tests/{interactive/cmd_deploy_test.go => integration/interactive_deploy_test.go} (99%) rename tests/{interactive/cmd_dev_test.go => integration/interactive_dev_test.go} (99%) rename tests/{interactive/cmd_init_test.go => integration/interactive_init_test.go} (99%) delete mode 100644 tests/integration/project/cmd_project_test.go delete mode 100644 tests/integration/project/project_suite_test.go delete mode 100644 tests/interactive/interactive_suit_test.go diff --git a/.ibm/pipelines/kubernetes-tests.sh b/.ibm/pipelines/kubernetes-tests.sh index 02ac58c8e..6e4783470 100755 --- a/.ibm/pipelines/kubernetes-tests.sh +++ b/.ibm/pipelines/kubernetes-tests.sh @@ -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]} diff --git a/.ibm/pipelines/openshift-tests.sh b/.ibm/pipelines/openshift-tests.sh index 76afc0fc3..def6cb2dc 100755 --- a/.ibm/pipelines/openshift-tests.sh +++ b/.ibm/pipelines/openshift-tests.sh @@ -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]} diff --git a/.ibm/pipelines/windows-test-script.ps1 b/.ibm/pipelines/windows-test-script.ps1 index ce60bd4e8..55f4d4d31 100644 --- a/.ibm/pipelines/windows-test-script.ps1 +++ b/.ibm/pipelines/windows-test-script.ps1 @@ -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 diff --git a/Makefile b/Makefile index 29edd8154..36ad082c6 100644 --- a/Makefile +++ b/Makefile @@ -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/ @@ -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 \ No newline at end of file diff --git a/scripts/openshiftci-Nightly-SBO-tests.sh b/scripts/openshiftci-Nightly-SBO-tests.sh index e63421feb..e5a578e30 100755 --- a/scripts/openshiftci-Nightly-SBO-tests.sh +++ b/scripts/openshiftci-Nightly-SBO-tests.sh @@ -30,6 +30,5 @@ oc whoami # Operatorhub integration tests make test-operator-hub -cp -r tests/reports $ARTIFACT_DIR oc logout diff --git a/scripts/openshiftci-periodic-tests.sh b/scripts/openshiftci-periodic-tests.sh index d4be0bd2e..6d23397df 100755 --- a/scripts/openshiftci-periodic-tests.sh +++ b/scripts/openshiftci-periodic-tests.sh @@ -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 diff --git a/scripts/openshiftci-presubmit-all-tests-old.sh b/scripts/openshiftci-presubmit-all-tests-old.sh deleted file mode 100755 index 39f65c97a..000000000 --- a/scripts/openshiftci-presubmit-all-tests-old.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# fail if some commands fails -set -e -# show commands -set -x - -ARCH=$(uname -m) -export CI="openshift" -if [ "${ARCH}" == "s390x" ]; then - make configure-installer-tests-cluster-s390x -elif [ "${ARCH}" == "ppc64le" ]; then - make configure-installer-tests-cluster-ppc64le -else - make configure-installer-tests-cluster -fi -make bin -mkdir -p $GOPATH/bin -make goget-ginkgo -export PATH="$PATH:$(pwd):$GOPATH/bin" -export CUSTOM_HOMEDIR=$ARTIFACT_DIR - -# Copy kubeconfig to temporary kubeconfig file -# Read and Write permission to temporary kubeconfig file -TMP_DIR=$(mktemp -d) -cp $KUBECONFIG $TMP_DIR/kubeconfig -chmod 640 $TMP_DIR/kubeconfig -export KUBECONFIG=$TMP_DIR/kubeconfig - -# Login as developer -oc login -u developer -p password@123 - -# Check login user name for debugging purpose -oc whoami - -if [ "${ARCH}" == "s390x" ]; then - # Integration tests - make test-integration - make test-cmd-login-logout - make test-cmd-project - # E2e tests - make test-e2e-all -elif [ "${ARCH}" == "ppc64le" ]; then - # Integration tests - make test-integration - make test-cmd-login-logout - make test-cmd-project - # E2e tests - make test-e2e-all -else - # 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 - - # E2e tests - make test-e2e-all || error=true - - # Fail the build if there is any error while test execution - if [ $error ]; then - exit -1 - fi -fi - -cp -r reports $ARTIFACT_DIR - -oc logout diff --git a/scripts/openshiftci-presubmit-all-tests.sh b/scripts/openshiftci-presubmit-all-tests.sh index 45a42e1a3..31a598936 100755 --- a/scripts/openshiftci-presubmit-all-tests.sh +++ b/scripts/openshiftci-presubmit-all-tests.sh @@ -35,32 +35,19 @@ 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 @@ -68,6 +55,5 @@ else fi fi -cp -r reports tests/reports $ARTIFACT_DIR oc logout diff --git a/tests/helper/odo_utils.go b/tests/helper/odo_utils.go index 3e6f32237..34ffb2983 100644 --- a/tests/helper/odo_utils.go +++ b/tests/helper/odo_utils.go @@ -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)) +} diff --git a/tests/integration/devfile/cmd_add_binding_test.go b/tests/integration/cmd_add_binding_test.go similarity index 99% rename from tests/integration/devfile/cmd_add_binding_test.go rename to tests/integration/cmd_add_binding_test.go index b2e9522d4..3f743e149 100644 --- a/tests/integration/devfile/cmd_add_binding_test.go +++ b/tests/integration/cmd_add_binding_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_analyze_test.go b/tests/integration/cmd_analyze_test.go similarity index 98% rename from tests/integration/devfile/cmd_analyze_test.go rename to tests/integration/cmd_analyze_test.go index ad88cd38c..dd9284396 100644 --- a/tests/integration/devfile/cmd_analyze_test.go +++ b/tests/integration/cmd_analyze_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "path/filepath" diff --git a/tests/integration/devfile/cmd_delete_test.go b/tests/integration/cmd_delete_test.go similarity index 99% rename from tests/integration/devfile/cmd_delete_test.go rename to tests/integration/cmd_delete_test.go index 2edd15335..7766b6175 100644 --- a/tests/integration/devfile/cmd_delete_test.go +++ b/tests/integration/cmd_delete_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_describe_component_test.go b/tests/integration/cmd_describe_component_test.go similarity index 99% rename from tests/integration/devfile/cmd_describe_component_test.go rename to tests/integration/cmd_describe_component_test.go index daa426c04..7e4b1d388 100644 --- a/tests/integration/devfile/cmd_describe_component_test.go +++ b/tests/integration/cmd_describe_component_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "os" diff --git a/tests/integration/devfile/cmd_describe_list_binding_test.go b/tests/integration/cmd_describe_list_binding_test.go similarity index 99% rename from tests/integration/devfile/cmd_describe_list_binding_test.go rename to tests/integration/cmd_describe_list_binding_test.go index 516e6aca3..e0becb8c0 100644 --- a/tests/integration/devfile/cmd_describe_list_binding_test.go +++ b/tests/integration/cmd_describe_list_binding_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_dev_debug_test.go b/tests/integration/cmd_dev_debug_test.go similarity index 99% rename from tests/integration/devfile/cmd_dev_debug_test.go rename to tests/integration/cmd_dev_debug_test.go index e25cc8644..4216d597a 100644 --- a/tests/integration/devfile/cmd_dev_debug_test.go +++ b/tests/integration/cmd_dev_debug_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_dev_test.go b/tests/integration/cmd_dev_test.go similarity index 99% rename from tests/integration/devfile/cmd_dev_test.go rename to tests/integration/cmd_dev_test.go index 3ed6d7c2c..71b1db23d 100644 --- a/tests/integration/devfile/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" @@ -22,7 +22,6 @@ import ( "github.com/onsi/gomega/gexec" "github.com/redhat-developer/odo/tests/helper" - "github.com/redhat-developer/odo/tests/integration/devfile/utils" ) var _ = Describe("odo dev command tests", func() { @@ -960,7 +959,7 @@ var _ = Describe("odo dev command tests", func() { helper.MatchAllInOutput(output, []string{"package.json"}) // Verify the sync env variables are correct - utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/webapp", "/apps", commonVar.CliRunner) + helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/webapp", "/apps", commonVar.CliRunner) }) }) @@ -988,7 +987,7 @@ var _ = Describe("odo dev command tests", func() { helper.MatchAllInOutput(output, []string{"package.json"}) // Verify the sync env variables are correct - utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/nodeshift", "/apps", commonVar.CliRunner) + helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/nodeshift", "/apps", commonVar.CliRunner) }) }) @@ -1015,7 +1014,7 @@ var _ = Describe("odo dev command tests", func() { helper.MatchAllInOutput(output, []string{"package.json"}) // Verify the sync env variables are correct - utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects/webapp", "/projects", commonVar.CliRunner) + helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects/webapp", "/projects", commonVar.CliRunner) }) }) @@ -1041,7 +1040,7 @@ var _ = Describe("odo dev command tests", func() { helper.MatchAllInOutput(output, []string{"package.json"}) // Verify the sync env variables are correct - utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects", "/projects", commonVar.CliRunner) + helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects", "/projects", commonVar.CliRunner) }) }) diff --git a/tests/integration/devfile/cmd_devfile_build_images_test.go b/tests/integration/cmd_devfile_build_images_test.go similarity index 99% rename from tests/integration/devfile/cmd_devfile_build_images_test.go rename to tests/integration/cmd_devfile_build_images_test.go index f3be93148..14b117dea 100644 --- a/tests/integration/devfile/cmd_devfile_build_images_test.go +++ b/tests/integration/cmd_devfile_build_images_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_devfile_deploy_test.go b/tests/integration/cmd_devfile_deploy_test.go similarity index 99% rename from tests/integration/devfile/cmd_devfile_deploy_test.go rename to tests/integration/cmd_devfile_deploy_test.go index 141a13914..429617f83 100644 --- a/tests/integration/devfile/cmd_devfile_deploy_test.go +++ b/tests/integration/cmd_devfile_deploy_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_devfile_init_test.go b/tests/integration/cmd_devfile_init_test.go similarity index 99% rename from tests/integration/devfile/cmd_devfile_init_test.go rename to tests/integration/cmd_devfile_init_test.go index 702e81ad6..cbb0de67e 100644 --- a/tests/integration/devfile/cmd_devfile_init_test.go +++ b/tests/integration/cmd_devfile_init_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "fmt" diff --git a/tests/integration/devfile/cmd_devfile_list_test.go b/tests/integration/cmd_devfile_list_test.go similarity index 99% rename from tests/integration/devfile/cmd_devfile_list_test.go rename to tests/integration/cmd_devfile_list_test.go index 4d73d3bfc..90e5e68f4 100644 --- a/tests/integration/devfile/cmd_devfile_list_test.go +++ b/tests/integration/cmd_devfile_list_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "path" diff --git a/tests/integration/devfile/cmd_devfile_registry_test.go b/tests/integration/cmd_devfile_registry_test.go similarity index 99% rename from tests/integration/devfile/cmd_devfile_registry_test.go rename to tests/integration/cmd_devfile_registry_test.go index 20818fb94..a1d5a9d3a 100644 --- a/tests/integration/devfile/cmd_devfile_registry_test.go +++ b/tests/integration/cmd_devfile_registry_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( . "github.com/onsi/ginkgo/v2" diff --git a/tests/integration/devfile/cmd_logs_test.go b/tests/integration/cmd_logs_test.go similarity index 99% rename from tests/integration/devfile/cmd_logs_test.go rename to tests/integration/cmd_logs_test.go index c343df041..97f96179a 100644 --- a/tests/integration/devfile/cmd_logs_test.go +++ b/tests/integration/cmd_logs_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "path/filepath" diff --git a/tests/integration/devfile/cmd_remove_binding_test.go b/tests/integration/cmd_remove_binding_test.go similarity index 98% rename from tests/integration/devfile/cmd_remove_binding_test.go rename to tests/integration/cmd_remove_binding_test.go index c2ba41af0..eff51d01e 100644 --- a/tests/integration/devfile/cmd_remove_binding_test.go +++ b/tests/integration/cmd_remove_binding_test.go @@ -1,4 +1,4 @@ -package devfile +package integration import ( "path/filepath" diff --git a/tests/integration/devfile/debug/debug_suite_test.go b/tests/integration/devfile/debug/debug_suite_test.go deleted file mode 100644 index 10dcdba7e..000000000 --- a/tests/integration/devfile/debug/debug_suite_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package debug - -import ( - "testing" - - "github.com/redhat-developer/odo/tests/helper" -) - -func TestDebug(t *testing.T) { - helper.RunTestSpecs(t, "Devfile Debug Suite") -} diff --git a/tests/integration/devfile/devfile_suite_test.go b/tests/integration/devfile/devfile_suite_test.go deleted file mode 100644 index 51f33a544..000000000 --- a/tests/integration/devfile/devfile_suite_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package devfile - -import ( - "testing" - - "github.com/redhat-developer/odo/tests/helper" -) - -func TestDevfiles(t *testing.T) { - helper.RunTestSpecs(t, "Devfile Suite") -} diff --git a/tests/integration/devfile/utils/utils.go b/tests/integration/devfile/utils/utils.go deleted file mode 100644 index 88e0bed8d..000000000 --- a/tests/integration/devfile/utils/utils.go +++ /dev/null @@ -1,41 +0,0 @@ -package utils - -import ( - "strings" - - "github.com/redhat-developer/odo/tests/helper" - - . "github.com/onsi/gomega" -) - -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 helper.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)) -} diff --git a/tests/interactive/cmd_add_binding_test.go b/tests/integration/interactive_add_binding_test.go similarity index 99% rename from tests/interactive/cmd_add_binding_test.go rename to tests/integration/interactive_add_binding_test.go index b4dce0834..463a907d0 100644 --- a/tests/interactive/cmd_add_binding_test.go +++ b/tests/integration/interactive_add_binding_test.go @@ -1,7 +1,7 @@ //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd -package interactive +package integration import ( "fmt" diff --git a/tests/interactive/cmd_deploy_test.go b/tests/integration/interactive_deploy_test.go similarity index 99% rename from tests/interactive/cmd_deploy_test.go rename to tests/integration/interactive_deploy_test.go index 112a6dfae..7307e6aa0 100644 --- a/tests/interactive/cmd_deploy_test.go +++ b/tests/integration/interactive_deploy_test.go @@ -1,7 +1,7 @@ //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd -package interactive +package integration import ( "fmt" diff --git a/tests/interactive/cmd_dev_test.go b/tests/integration/interactive_dev_test.go similarity index 99% rename from tests/interactive/cmd_dev_test.go rename to tests/integration/interactive_dev_test.go index b78112103..cfd7e39b8 100644 --- a/tests/interactive/cmd_dev_test.go +++ b/tests/integration/interactive_dev_test.go @@ -1,7 +1,7 @@ //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd -package interactive +package integration import ( "fmt" diff --git a/tests/interactive/cmd_init_test.go b/tests/integration/interactive_init_test.go similarity index 99% rename from tests/interactive/cmd_init_test.go rename to tests/integration/interactive_init_test.go index 41d205146..86cd89e6e 100644 --- a/tests/interactive/cmd_init_test.go +++ b/tests/integration/interactive_init_test.go @@ -1,7 +1,7 @@ //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd -package interactive +package integration import ( "fmt" diff --git a/tests/integration/project/cmd_project_test.go b/tests/integration/project/cmd_project_test.go deleted file mode 100644 index 33bf5b10b..000000000 --- a/tests/integration/project/cmd_project_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package project - -import ( - "os" - "strings" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/redhat-developer/odo/tests/helper" -) - -var _ = Describe("odo project command tests", func() { - var commonVar helper.CommonVar - - // This is run before every Spec (It) - var _ = BeforeEach(func() { - commonVar = helper.CommonBeforeEach() - }) - - // Clean up after the test - // This is run after every Spec (It) - var _ = AfterEach(func() { - helper.CommonAfterEach(commonVar) - }) - - It("should display the help of project command", func() { - projectHelp := helper.Cmd("odo", "project", "-h").ShouldPass().Out() - Expect(projectHelp).To(ContainSubstring("Perform project operations")) - }) - - It("should display only the project name when running command with -q flag", func() { - projectName := helper.Cmd("odo", "project", "get", "-q").ShouldPass().Out() - Expect(projectName).Should(Equal(commonVar.Project)) - }) - - It("should list current empty project", func() { - helper.WaitForCmdOut("odo", []string{"project", "list"}, 1, true, func(output string) bool { - return strings.Contains(output, commonVar.Project) - }) - }) - - When("creating a new project", func() { - var projectName string - - BeforeEach(func() { - projectName = "cmd-project-" + helper.RandString(6) - helper.Cmd("odo", "project", "create", projectName).ShouldPass() - }) - - It("should delete a project with --wait", func() { - output := helper.Cmd("odo", "project", "delete", projectName, "-f", "--wait").ShouldPass().Out() - Expect(output).To(ContainSubstring("Waiting for project to be deleted")) - }) - }) - - When("user is logged out", func() { - var token string - BeforeEach(func() { - if os.Getenv("KUBERNETES") == "true" { - Skip("Openshift specific scenario.") - } - ocRunner := helper.NewOcRunner("oc") - token = ocRunner.GetToken() - helper.Cmd("odo", "logout").ShouldPass() - }) - AfterEach(func() { - helper.Cmd("odo", "login", "--token", token).ShouldPass() - }) - It("should show login message when setting project and not login", func() { - err := helper.Cmd("odo", "project", "set", "something").ShouldFail().Err() - Expect(err).To(ContainSubstring("Unauthorized to access the cluster")) - }) - It("should show login message when deleting project and not login", func() { - err := helper.Cmd("odo", "project", "delete", "something").ShouldFail().Err() - Expect(err).To(ContainSubstring("Unauthorized to access the cluster")) - }) - }) -}) diff --git a/tests/integration/project/project_suite_test.go b/tests/integration/project/project_suite_test.go deleted file mode 100644 index 997621b0c..000000000 --- a/tests/integration/project/project_suite_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package project - -import ( - "testing" - - "github.com/redhat-developer/odo/tests/helper" -) - -func TestProject(t *testing.T) { - helper.RunTestSpecs(t, "Project Suite") -} diff --git a/tests/interactive/interactive_suit_test.go b/tests/interactive/interactive_suit_test.go deleted file mode 100644 index 6869e99a8..000000000 --- a/tests/interactive/interactive_suit_test.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build !race && (linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd) -// +build !race -// +build linux darwin dragonfly solaris openbsd netbsd freebsd - -package interactive - -import ( - "testing" - - "github.com/redhat-developer/odo/tests/helper" -) - -func TestInteractive(t *testing.T) { - helper.RunTestSpecs(t, "Interactive Suite") -}