Commit d2caed34 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-group-import-subgroup' into 'master'

Use subgroup for gitlab migration tests

See merge request gitlab-org/gitlab!77937
parents 8996213e 78a95536
......@@ -3,18 +3,21 @@
module QA
module Resource
class BulkImportGroup < Group
attributes :source_group_path,
attributes :source_group,
:destination_group,
:import_id
attribute :destination_group_path do
source_group_path
end
attribute :access_token do
api_client.personal_access_token
end
alias_method :path, :source_group_path
# In most cases we will want to set path the same as source group
# but it can be set to a custom name as well when imported via API
attribute :destination_group_path do
source_group.path
end
# Can't define path as attribue since @path is set in base class initializer
alias_method :path, :destination_group_path
delegate :gitlab_address, to: 'QA::Runtime::Scenario'
......@@ -51,9 +54,9 @@ module QA
entities: [
{
source_type: 'group_entity',
source_full_path: source_group_path,
source_full_path: source_group.full_path,
destination_name: destination_group_path,
destination_namespace: sandbox.path
destination_namespace: sandbox.full_path
}
]
}
......
# frozen_string_literal: true
module QA
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration' do
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin }
......@@ -22,9 +20,18 @@ module QA
end
end
let(:destination_group) do
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.path = "destination-group-for-import-#{SecureRandom.hex(4)}"
end
end
let(:source_group) do
Resource::Sandbox.fabricate_via_api! do |group|
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end
......@@ -33,8 +40,8 @@ module QA
let(:imported_group) do
Resource::BulkImportGroup.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.source_group_path = source_group.path
group.sandbox = destination_group
group.source_group = source_group
end
end
......
......@@ -3,9 +3,7 @@
require_relative 'gitlab_project_migration_common'
module QA
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration', quarantine: {
only: { job: 'praefect' },
type: :investigating,
......
......@@ -3,9 +3,7 @@
require_relative 'gitlab_project_migration_common'
module QA
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration', quarantine: {
only: { job: 'praefect' },
type: :investigating,
......
......@@ -3,9 +3,7 @@
require_relative 'gitlab_project_migration_common'
module QA
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration', quarantine: {
only: { job: 'praefect' },
type: :investigating,
......
......@@ -20,8 +20,16 @@ module QA
end
end
let(:destination_group) do
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.path = "destination-group-for-import-#{SecureRandom.hex(4)}"
end
end
let(:source_group) do
Resource::Sandbox.fabricate_via_api! do |group|
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end
......@@ -38,8 +46,8 @@ module QA
let(:imported_group) do
Resource::BulkImportGroup.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.source_group_path = source_group.path
group.sandbox = destination_group
group.source_group = source_group
end
end
......
......@@ -36,7 +36,7 @@ module QA
Resource::BulkImportGroup.init do |group|
group.api_client = api_client
group.sandbox = sandbox
group.source_group_path = source_group.path
group.source_group = source_group
end
end
......
# frozen_string_literal: true
module QA
# Do not run on staging since another top level group has to be created which doesn't have premium license
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration' do
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:api_client) { Runtime::API::Client.new(user: user) }
......@@ -29,9 +28,18 @@ module QA
end
end
let(:destination_group) do
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.path = "destination-group-for-import-#{SecureRandom.hex(4)}"
end
end
let(:source_group) do
Resource::Sandbox.fabricate_via_api! do |group|
Resource::Group.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end
......@@ -40,8 +48,8 @@ module QA
let(:imported_group) do
Resource::BulkImportGroup.fabricate_via_api! do |group|
group.api_client = api_client
group.sandbox = sandbox
group.source_group_path = source_group.path
group.sandbox = destination_group
group.source_group = source_group
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment