Skip to content

[EE] First iteration to allow creating QA resources using the API

Rémy Coutable requested to merge ee-qa-123 into master

EE MR for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21302.

What does this MR do?

  1. This adds a new #fabricate_via_api! method to create a QA factory resource using the API, which is much faster than via the Web UI
  • To enable resource creation via the API, all you have to define are the following methods: #api_post_path, #api_get_path, #api_post_body, and optionally the #transform_api_resource method
  1. .fabricate! use the API fabrication method by default, and this method fallback to the Browser UI fabrication method if not implemented

  2. Dependencies fabrication is done using the API fabrication method by default, and this method fallback to the Browser UI fabrication method if not implemented

  3. Only sandbox, group, and project factories implement the API fabrication method for now.

Verbose output (with VERBOSE=1)

› VERBOSE=1 CHROME_HEADLESS=1 GITLAB_USERNAME="root" GITLAB_PASSWORD="5iveL\!fe" bundle exec bin/qa Test::Instance::All http://localhost:3000 -- qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb:6

Run options:
  include {:locations=>{"./qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb"=>[6]}}
  exclude {:orchestrated=>true}

Randomized with seed 54895

create
  Merge request creation
==> Built a QA::Factory::Resource::PersonalAccessToken via browser_ui with args [] in 4.658539 seconds

====> Built a QA::Factory::Resource::Sandbox as a dependency of QA::Factory::Resource::Group via api with args [] in 0.191949 seconds
===> Built a QA::Factory::Resource::Group as a dependency of QA::Factory::Resource::Project via api with args [] in 0.386215 seconds
==> Built a QA::Factory::Resource::Project via api with args [] in 0.650311 seconds

==> Built a QA::Factory::Resource::ProjectMilestone via browser_ui with args [] in 7.067621 seconds

Switched to a new branch 'master'
===> Built a QA::Factory::Repository::ProjectPush as a dependency of QA::Factory::Resource::MergeRequest via browser_ui with args [] in 3.930856 seconds
fatal: A branch named 'master' already exists.
===> Built a QA::Factory::Repository::ProjectPush as a dependency of QA::Factory::Resource::MergeRequest via browser_ui with args [] in 4.964991 seconds
fatal: A branch named 'master' already exists.
===> Built a QA::Factory::Repository::ProjectPush as a dependency of QA::Factory::Resource::MergeRequest via browser_ui with args [] in 3.499711 seconds
fatal: A branch named 'master' already exists.
===> Built a QA::Factory::Repository::ProjectPush as a dependency of QA::Factory::Resource::MergeRequest via browser_ui with args [] in 4.503717 seconds
==> Built a QA::Factory::Resource::MergeRequest via browser_ui with args [] in 8.641776 seconds

    user creates a new merge request

Top 1 slowest examples (68.89 seconds, 100.0% of total time):
  create Merge request creation user creates a new merge request
    68.89 seconds ./qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb:6

Finished in 1 minute 8.89 seconds (files took 0.4811 seconds to load)
1 example, 0 failures

Randomized with seed 54895

What are the relevant issue numbers?

Solves gitlab-qa#123 (closed), gitlab-qa#313 (closed)

Does this MR meet the acceptance criteria?

Merge request reports