diff --git a/test/integration/features/experimental-feature.feature b/test/integration/features/experimental-feature.feature new file mode 100644 index 0000000000..0e938b6e1a --- /dev/null +++ b/test/integration/features/experimental-feature.feature @@ -0,0 +1,47 @@ +@experimental-feature +Feature: Experimental Feature + As a user I can able to enable, run and disable experimental feature + + Scenario: User cannot start minishift experimental feature without setting up the environment variable MINISHIFT_ENABLE_EXPERIMENTAL + Given Minishift has state "Does Not Exist" + Then executing "minishift start --extra-clusterup-flags --service-catalog" fails + And stderr should contain + """ + Error: unknown flag: --extra-clusterup-flags + """ + + Scenario: User can enable minishift experimental feature + Given Minishift has state "Does Not Exist" + When setting up environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" with value "y" succeeds + Then executing "minishift start -h" succeeds + And stdout should contain + """ + --extra-clusterup-flags string + """ + + Scenario: User can start minishift experimental feature + Given Minishift has state "Does Not Exist" + And image caching is disabled + And environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" value should be "y" + Then executing "minishift start --extra-clusterup-flags --service-catalog" succeeds + And stdout should contain + """ + -- Extra 'oc' cluster up flags (experimental) ... + '--service-catalog' + """ + + Scenario: User can disable minishift experimental feature + Given Minishift has state "Running" + And environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" value should be "y" + Then unset environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" succeeds + When executing "minishift start --extra-clusterup-flags --service-catalog" fails + Then stderr should contain + """ + Error: unknown flag: --extra-clusterup-flags + """ + + Scenario: Deleting Minishift + Given Minishift has state "Running" + When executing "minishift delete --force" succeeds + Then Minishift has state "Does Not Exist" + \ No newline at end of file diff --git a/test/integration/testsuite/minishift.go b/test/integration/testsuite/minishift.go index 46ee7a149e..b17779ed69 100644 --- a/test/integration/testsuite/minishift.go +++ b/test/integration/testsuite/minishift.go @@ -350,3 +350,26 @@ func (m *Minishift) minishiftHomeDirectoryShouldntExist(dir string) error { return fmt.Errorf("Directory %s exists", dir) } + +func (m *Minishift) setEnvironmentVariable(variable string, value string) error { + os.Setenv(variable, value) + if os.Getenv(variable) != value { + return fmt.Errorf("Error in setting environment variable %s=%s in the current shell", variable, value) + } + return nil +} + +func (m *Minishift) getEnvironmentVariable(variable string, value string) error { + if os.Getenv(variable) != value { + return fmt.Errorf("Environment variable value Expected: %s, Actual: %s in the current shell", value, os.Getenv(variable)) + } + return nil +} + +func (m *Minishift) unSetEnvironmentVariable(variable string) error { + os.Unsetenv(variable) + if os.Getenv(variable) != "" { + return fmt.Errorf("Error in removing environment variable %s in the current shell", variable) + } + return nil +} diff --git a/test/integration/testsuite/testsuite.go b/test/integration/testsuite/testsuite.go index 636ceb7b92..ba6a863f6c 100644 --- a/test/integration/testsuite/testsuite.go +++ b/test/integration/testsuite/testsuite.go @@ -108,6 +108,14 @@ func FeatureContext(s *godog.Suite) { s.Step(`^scenario variable "(.*)" should not be empty$`, variableShouldNotBeEmpty) + // steps for set, get and unset environment variable + s.Step(`^setting up environment variable "(.*)" with value "(.*)" succeeds$`, + MinishiftInstance.setEnvironmentVariable) + s.Step(`^environment variable "(.*)" value should be "(.*)"$`, + MinishiftInstance.getEnvironmentVariable) + s.Step(`^unset environment variable "(.*)" succeeds$`, + MinishiftInstance.unSetEnvironmentVariable) + // steps for rollout check s.Step(`^services? "([^"]*)" rollout successfully$`, MinishiftInstance.rolloutServicesSuccessfully)