Skip to content

Commit

Permalink
Issue minishift#2322 Add integration test step to test experimental f…
Browse files Browse the repository at this point in the history
…eature
  • Loading branch information
amitkrout committed May 10, 2018
1 parent 286d220 commit d74e4fc
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
62 changes: 62 additions & 0 deletions test/integration/features/experimental-flags.feature
@@ -0,0 +1,62 @@
@experimental-flags
Feature: Experimental Flags
Experimental flag --extra-clusterup-flags will be enabled by setting MINISHIFT_ENABLE_EXPERIMENTAL environment variable,
this flag will provide access to some of upcoming feature and experiments.

Scenario: User cannot start minishift experimental feature directly
Given Minishift has state "Does Not Exist"
Then executing "minishift start --service-catalog" fails
And stderr should contain
"""
Error: unknown flag: --service-catalog
"""

Scenario: User cannot use minishift flag --extra-clusterup-flag directly
Given Minishift has state "Does Not Exist"
Then executing "minishift start --extra-clusterup-flags" fails
And stderr should contain
"""
Error: unknown flag: --extra-clusterup-flags
"""

Scenario: User can enable and disable minishift experimental flag --extra-clusterup-flags
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
"""
When unset environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" succeeds
Then executing "minishift start -h" succeeds
And stdout should not contain
"""
--extra-clusterup-flags string
"""

Scenario: User cannot use minishift experimental flag --extra-clusterup-flag without experimental feature name
Given Minishift has state "Does Not Exist"
When setting up environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" with value "y" succeeds
Then executing "minishift start --extra-clusterup-flags" fails
And stderr should contain
"""
Error: flag needs an argument: --extra-clusterup-flags
"""
And unset environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" succeeds

Scenario: User can start minishift experimental feature
Given Minishift has state "Does Not Exist"
And image caching is disabled
And setting up environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" with value "y" succeeds
Then executing "minishift start --extra-clusterup-flags --service-catalog" succeeds
And stdout should contain
"""
-- Extra 'oc' cluster up flags (experimental) ...
'--service-catalog'
"""
And unset environment variable "MINISHIFT_ENABLE_EXPERIMENTAL" succeeds

Scenario: Deleting Minishift
Given Minishift has state "Running"
When executing "minishift delete --force" succeeds
Then Minishift has state "Does Not Exist"
14 changes: 14 additions & 0 deletions test/integration/testsuite/testsuite.go
Expand Up @@ -109,6 +109,12 @@ func FeatureContext(s *godog.Suite) {
s.Step(`^scenario variable "(.*)" should not be empty$`,
variableShouldNotBeEmpty)

// steps for set and unset environment variable
s.Step(`^setting up environment variable "(.*)" with value "(.*)" succeeds$`,
setEnvironmentVariable)
s.Step(`^unset environment variable "(.*)" succeeds$`,
unSetEnvironmentVariable)

// steps for rollout check
s.Step(`^services? "([^"]*)" rollout successfully$`,
MinishiftInstance.rolloutServicesSuccessfully)
Expand Down Expand Up @@ -778,3 +784,11 @@ func directoryShouldntExist(dir string) error {

return fmt.Errorf("Directory %s exists", dir)
}

func setEnvironmentVariable(key string, value string) error {
return os.Setenv(key, value)
}

func unSetEnvironmentVariable(key string) error {
return os.Unsetenv(key)
}

0 comments on commit d74e4fc

Please sign in to comment.