mirror of
				https://github.com/redhat-developer/odo.git
				synced 2025-10-19 03:06:19 +03:00 
			
		
		
		
	devfile create Interation test on kubernetes cluster using travis CI (#2884)
* Run devfile create Interation test on kubernetes cluster * Skipping s2i image related test on kubernetes cluster
This commit is contained in:
		| @@ -168,7 +168,7 @@ jobs: | ||||
|     # Run devfile integration test on Kubernetes cluster     | ||||
|     - <<: *base-test | ||||
|       stage: test | ||||
|       name: "devfile catalog, watch, push and delete command integration tests on kubernetes cluster" | ||||
|       name: "devfile catalog, watch, push, delete and create command integration tests on kubernetes cluster" | ||||
|       env: | ||||
|         - MINIKUBE_WANTUPDATENOTIFICATION=false | ||||
|         - MINIKUBE_WANTREPORTERRORPROMPT=false | ||||
| @@ -193,3 +193,4 @@ jobs: | ||||
|         - travis_wait make test-cmd-devfile-watch | ||||
|         - travis_wait make test-cmd-devfile-push | ||||
|         - travis_wait make test-cmd-devfile-delete | ||||
|         - travis_wait make test-cmd-devfile-create | ||||
|   | ||||
| @@ -15,26 +15,30 @@ import ( | ||||
| var _ = Describe("odo devfile create command tests", func() { | ||||
| 	const devfile = "devfile.yaml" | ||||
| 	const envFile = ".odo/env/env.yaml" | ||||
| 	var namespace string | ||||
| 	var context string | ||||
| 	var currentWorkingDirectory string | ||||
| 	var devfilePath string | ||||
| 	var namespace, context, currentWorkingDirectory, devfilePath, originalKubeconfig string | ||||
|  | ||||
| 	// Using program commmand according to cliRunner in devfile | ||||
| 	cliRunner := helper.GetCliRunner() | ||||
|  | ||||
| 	// This is run after every Spec (It) | ||||
| 	var _ = BeforeEach(func() { | ||||
| 		SetDefaultEventuallyTimeout(10 * time.Minute) | ||||
| 		namespace = helper.CreateRandProject() | ||||
| 		context = helper.CreateNewContext() | ||||
| 		currentWorkingDirectory = helper.Getwd() | ||||
| 		helper.Chdir(context) | ||||
| 		os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) | ||||
| 		helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") | ||||
| 		originalKubeconfig = os.Getenv("KUBECONFIG") | ||||
| 		helper.LocalKubeconfigSet(context) | ||||
| 		namespace = cliRunner.CreateRandNamespaceProject() | ||||
| 		currentWorkingDirectory = helper.Getwd() | ||||
| 		helper.Chdir(context) | ||||
| 	}) | ||||
|  | ||||
| 	// This is run after every Spec (It) | ||||
| 	var _ = AfterEach(func() { | ||||
| 		helper.DeleteProject(namespace) | ||||
| 		cliRunner.DeleteNamespaceProject(namespace) | ||||
| 		helper.Chdir(currentWorkingDirectory) | ||||
| 		err := os.Setenv("KUBECONFIG", originalKubeconfig) | ||||
| 		Expect(err).NotTo(HaveOccurred()) | ||||
| 		helper.DeleteDir(context) | ||||
| 		os.Unsetenv("GLOBALODOCONFIG") | ||||
| 	}) | ||||
| @@ -48,7 +52,14 @@ var _ = Describe("odo devfile create command tests", func() { | ||||
| 			Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(ContainSubstring(experimentalOutputMsg)) | ||||
|  | ||||
| 		}) | ||||
| 	}) | ||||
|  | ||||
| 	Context("Disabling experimental preference should show a disclaimer", func() { | ||||
| 		JustBeforeEach(func() { | ||||
| 			if os.Getenv("KUBERNETES") == "true" { | ||||
| 				Skip("Skipping test because s2i image is not supported on Kubernetes cluster") | ||||
| 			} | ||||
| 		}) | ||||
| 		It("checks that the experimental warning does *not* appear when Experimental is set to false for create", func() { | ||||
| 			helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f") | ||||
| 			helper.CopyExample(filepath.Join("source", "nodejs"), context) | ||||
| @@ -67,7 +78,12 @@ var _ = Describe("odo devfile create command tests", func() { | ||||
| 		It("should fail to create the devfile componet with invalid component type", func() { | ||||
| 			fakeComponentName := "fake-component" | ||||
| 			output := helper.CmdShouldFail("odo", "create", fakeComponentName) | ||||
| 			expectedString := "component type \"" + fakeComponentName + "\" not found" | ||||
| 			var expectedString string | ||||
| 			if os.Getenv("KUBERNETES") == "true" { | ||||
| 				expectedString = "component type not found" | ||||
| 			} else { | ||||
| 				expectedString = "component type \"" + fakeComponentName + "\" not found" | ||||
| 			} | ||||
| 			helper.MatchAllInOutput(output, []string{expectedString}) | ||||
| 		}) | ||||
| 	}) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Priti Kumari
					Priti Kumari