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 7, 2018
1 parent ec15fed commit 08641e3
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
47 changes: 47 additions & 0 deletions test/integration/features/experimental-flags.feature
@@ -0,0 +1,47 @@
@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 without enabling experimental flag
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 flag
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 through --extra-clusterup-flag flag
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 flag
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"
15 changes: 15 additions & 0 deletions test/integration/testsuite/minishift.go
Expand Up @@ -350,3 +350,18 @@ func (m *Minishift) minishiftHomeDirectoryShouldntExist(dir string) error {

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

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

func (m *Minishift) compareEnvironmentVariableValue(key string, value string) error {
if os.Getenv(key) != value {
return fmt.Errorf("Environment variable %s has value Expected: %s, Actual: %s in the current shell", key, value, os.Getenv(key))
}
return nil
}

func (m *Minishift) unSetEnvironmentVariable(key string) error {
return os.Unsetenv(key)
}
8 changes: 8 additions & 0 deletions test/integration/testsuite/testsuite.go
Expand Up @@ -108,6 +108,14 @@ func FeatureContext(s *godog.Suite) {
s.Step(`^scenario variable "(.*)" should not be empty$`,
variableShouldNotBeEmpty)

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

// steps for rollout check
s.Step(`^services? "([^"]*)" rollout successfully$`,
MinishiftInstance.rolloutServicesSuccessfully)
Expand Down

0 comments on commit 08641e3

Please sign in to comment.