summaryrefslogtreecommitdiff
path: root/qa/qa/runtime/feature.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/runtime/feature.rb')
-rw-r--r--qa/qa/runtime/feature.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/qa/qa/runtime/feature.rb b/qa/qa/runtime/feature.rb
index 1b4ae7adbbe..b74f343ba7b 100644
--- a/qa/qa/runtime/feature.rb
+++ b/qa/qa/runtime/feature.rb
@@ -18,6 +18,11 @@ module QA
set_feature(key, false)
end
+ def enabled?(key)
+ feature = JSON.parse(get_features).find { |flag| flag["name"] == key }
+ feature && feature["state"] == "on"
+ end
+
private
def api_client
@@ -31,6 +36,12 @@ module QA
raise SetFeatureError, "Setting feature flag #{key} to #{value} failed with `#{response}`."
end
end
+
+ def get_features
+ request = Runtime::API::Request.new(api_client, "/features")
+ response = get(request.url)
+ response.body
+ end
end
end
end