diff options
Diffstat (limited to 'qa/qa/runtime/env.rb')
-rw-r--r-- | qa/qa/runtime/env.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index c7052a9f300..c4500f9be90 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -7,6 +7,16 @@ module QA attr_writer :personal_access_token + # The environment variables used to indicate if the environment under test + # supports the given feature + SUPPORTED_FEATURES = { + git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2' + }.freeze + + def supported_features + SUPPORTED_FEATURES + end + def debug? enabled?(ENV['QA_DEBUG'], default: false) end @@ -104,6 +114,15 @@ module QA raise ArgumentError, "Please provide GITHUB_ACCESS_TOKEN" end + # Returns true if there is an environment variable that indicates that + # the feature is supported in the environment under test. + # All features are supported by default. + def can_test?(feature) + raise ArgumentError, %Q(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature + + enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true) + end + private def enabled?(value, default: true) |