diff options
author | ddavison <ddavison@gitlab.com> | 2019-04-30 16:06:40 -0700 |
---|---|---|
committer | ddavison <ddavison@gitlab.com> | 2019-05-06 19:10:04 -0700 |
commit | 63cbaa5e8e2830d16f8a0a3d56d66202fdcd2653 (patch) | |
tree | e8c5ae9640e978610b40a1f132cdd16a23bb4f92 /qa | |
parent | 168cd1ec980dce6c6d5bde5fb46b7794f6ba3002 (diff) | |
download | gitlab-ce-63cbaa5e8e2830d16f8a0a3d56d66202fdcd2653.tar.gz |
Delegate CiVariable delegation to API
Instead of Resource::CiVariable fabricating via the browser_ui, let's
delegate to the API instead. (will shave off roughly 3-4s every use)
Override resource_web_url to catch ResourceURLMissingError as there
is no "show" action for a CI/CD var
Signed-off-by: ddavison <ddavison@gitlab.com>
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/resource/ci_variable.rb | 27 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/qa/qa/resource/ci_variable.rb b/qa/qa/resource/ci_variable.rb index d82de4cb816..341d3c1ed7e 100644 --- a/qa/qa/resource/ci_variable.rb +++ b/qa/qa/resource/ci_variable.rb @@ -25,6 +25,33 @@ module QA end end end + + def fabricate_via_api! + resource_web_url(api_get) + rescue ResourceNotFoundError + super + end + + def resource_web_url(resource) + super + rescue ResourceURLMissingError + # this particular resource does not expose a web_url property + end + + def api_get_path + "/projects/#{project.id}/variables/#{key}" + end + + def api_post_path + "/projects/#{project.id}/variables" + end + + def api_post_body + { + key: key, + value: value + } + end end end end diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index de1e9f04c36..c1a0cff86d8 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -7,6 +7,7 @@ module QA class Project < Base include Events::Project + attribute :id attribute :name attribute :description |