Skip to content

Commit

Permalink
Skipping s2i image related test on kubernetes cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
prietyc123 committed Jun 11, 2020
1 parent c367b7b commit a0f6e66
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
8 changes: 8 additions & 0 deletions pkg/odo/cli/component/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ var EnvFilePath = filepath.Join(LocalDirectoryDefaultLocation, envFile)
var ConfigFilePath = filepath.Join(LocalDirectoryDefaultLocation, configFile)

var createLongDesc = ktemplates.LongDesc(`Create a configuration describing a component.
If a component name is not provided, it'll be auto-generated.
A full list of component types that can be deployed is available using: 'odo catalog list'
By default, builder images (component type) will be used from the current namespace. You can explicitly supply a namespace by using: odo create namespace/name:version
If version is not specified by default, latest will be chosen as the version.`)

Expand All @@ -116,14 +119,19 @@ Note: When you use odo with experimental mode enabled and create devfile compone
# Create new Node.js component
%[1]s nodejs
# Create new Node.js component named 'frontend' with the source in './frontend' directory
%[1]s nodejs frontend --context ./frontend
# Create new Java component with binary named sample.jar in './target' directory
%[1]s java:8 --binary target/sample.jar
# Create new Node.js component with source from remote git repository
%[1]s nodejs --git https://github.com/openshift/nodejs-ex.git
# Create new Node.js component with custom ports, additional environment variables and memory and cpu limits
%[1]s nodejs --port 8080,8100/tcp,9100/udp --env key=value,key1=value1 --memory 4Gi --cpu 2
# Create new Node.js component and download the sample project named nodejs-web-app
%[1]s nodejs --downloadSource=nodejs-web-app`)

Expand Down
34 changes: 17 additions & 17 deletions tests/integration/devfile/cmd_devfile_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +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)
context = helper.CreateNewContext()
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true")
if os.Getenv("KUBERNETES") == "true" {
homeDir := helper.GetUserHomeDir()
kubeConfigFile := helper.CopyKubeConfigFile(filepath.Join(homeDir, ".kube", "config"), filepath.Join(context, "config"))
namespace = helper.CreateRandNamespace(kubeConfigFile)
} else {
namespace = helper.CreateRandProject()
}
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() {
if os.Getenv("KUBERNETES") == "true" {
helper.DeleteNamespace(namespace)
os.Unsetenv("KUBECONFIG")
} else {
helper.DeleteProject(namespace)
}
cliRunner.DeleteNamespaceProject(namespace)
helper.Chdir(currentWorkingDirectory)
err := os.Setenv("KUBECONFIG", originalKubeconfig)
Expect(err).NotTo(HaveOccurred())
helper.DeleteDir(context)
os.Unsetenv("GLOBALODOCONFIG")
})
Expand All @@ -59,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)
Expand Down

0 comments on commit a0f6e66

Please sign in to comment.