Commit 33ec5295 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'acunskis-fix-top-level-group' into 'master'

E2E: Create top level group via UI on dot_com environment

See merge request gitlab-org/gitlab!74366
parents ee37181b e7405d7e
...@@ -7,6 +7,17 @@ module QA ...@@ -7,6 +7,17 @@ module QA
# creating it if it doesn't yet exist. # creating it if it doesn't yet exist.
# #
class Sandbox < GroupBase class Sandbox < GroupBase
class << self
# Force top level group creation via UI if test is executed on dot_com environment
def fabricate!(*args, &prepare_block)
return fabricate_via_browser_ui!(*args, &prepare_block) if Specs::Helpers::ContextSelector.dot_com?
fabricate_via_api!(*args, &prepare_block)
rescue NotImplementedError
fabricate_via_browser_ui!(*args, &prepare_block)
end
end
def initialize def initialize
@path = Runtime::Namespace.sandbox_name @path = Runtime::Namespace.sandbox_name
end end
......
...@@ -22,9 +22,7 @@ module QA ...@@ -22,9 +22,7 @@ module QA
end end
let(:source_group) do let(:source_group) do
# top level group can't be created on staging via api, create via UI Resource::Sandbox.fabricate! do |group|
fabricate_method = staging? ? :fabricate_via_browser_ui! : :fabricate_via_api!
Resource::Sandbox.send(fabricate_method) do |group|
group.api_client = api_client group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}" group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
# This test is disabled on staging and production due to `top_level_group_creation_enabled` set to false. RSpec.describe 'Manage' do
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/324808#note_531060031
RSpec.describe 'Manage', quarantine: { only: [:staging, :production], issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/324808', type: :waiting_on } do
describe 'prevent forking outside group' do describe 'prevent forking outside group' do
let!(:group_for_fork) do let!(:group_for_fork) do
Resource::Sandbox.fabricate_via_api! do |sandbox_group| Resource::Sandbox.fabricate! do |sandbox_group|
sandbox_group.path = "group_for_fork_#{SecureRandom.hex(8)}" sandbox_group.path = "group_for_fork_#{SecureRandom.hex(8)}"
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
# This test is disabled on staging and production due to `top_level_group_creation_enabled` set to false. RSpec.describe 'Package', :orchestrated, :group_saml, :requires_admin do
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/342329#note_696599160
# When FF enabled, the test is failing with https://gitlab.com/gitlab-org/gitlab/-/issues/342523
RSpec.describe 'Package', :orchestrated, :group_saml, :requires_admin, quarantine: { only: [:staging, :production], issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/342523', type: :investigating } do
describe 'Dependency Proxy Group SSO' do describe 'Dependency Proxy Group SSO' do
include Support::API include Support::API
let!(:group) do let!(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox_group| Resource::Sandbox.fabricate! do |sandbox_group|
sandbox_group.path = "saml_sso_group_with_dependency_proxy_#{SecureRandom.hex(8)}" sandbox_group.path = "saml_sso_group_with_dependency_proxy_#{SecureRandom.hex(8)}"
end end
end end
...@@ -81,12 +78,12 @@ module QA ...@@ -81,12 +78,12 @@ module QA
commit.project = project commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml' commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{ commit.add_files([{
file_path: '.gitlab-ci.yml', file_path: '.gitlab-ci.yml',
content: content:
<<~YAML <<~YAML
dependency-proxy-pull-test: dependency-proxy-pull-test:
image: "docker:stable" image: "docker:stable"
services: services:
- name: "docker:stable-dind" - name: "docker:stable-dind"
command: ["--insecure-registry=#{gitlab_host_with_port}"] command: ["--insecure-registry=#{gitlab_host_with_port}"]
before_script: before_script:
...@@ -101,7 +98,7 @@ module QA ...@@ -101,7 +98,7 @@ module QA
tags: tags:
- "runner-for-#{project.name}" - "runner-for-#{project.name}"
YAML YAML
}]) }])
end end
project.visit! project.visit!
...@@ -127,7 +124,7 @@ module QA ...@@ -127,7 +124,7 @@ module QA
end end
def visit_group_sso_url def visit_group_sso_url
Runtime::Logger.debug(%Q[Visiting managed_group_url at "#{group_sso_url}"]) Runtime::Logger.debug(%(Visiting managed_group_url at "#{group_sso_url}"))
page.visit group_sso_url page.visit group_sso_url
Support::Waiter.wait_until { current_url == group_sso_url } Support::Waiter.wait_until { current_url == group_sso_url }
......
...@@ -15,7 +15,7 @@ module QA ...@@ -15,7 +15,7 @@ module QA
end end
let(:group) do let(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox| Resource::Sandbox.fabricate! do |sandbox|
sandbox.path = "gitlab-qa-group-#{hash}" sandbox.path = "gitlab-qa-group-#{hash}"
sandbox.api_client = Runtime::API::Client.as_admin sandbox.api_client = Runtime::API::Client.as_admin
end end
......
...@@ -17,15 +17,13 @@ module QA ...@@ -17,15 +17,13 @@ module QA
# after the test runs since GitLab will not allow deletion of a group # after the test runs since GitLab will not allow deletion of a group
# that has a Subscription attached # that has a Subscription attached
let(:group) do let(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox| Resource::Sandbox.fabricate! do |sandbox|
sandbox.path = "gitlab-qa-group-#{hash}" sandbox.path = "gitlab-qa-group-#{hash}"
sandbox.api_client = Runtime::API::Client.as_admin sandbox.api_client = Runtime::API::Client.as_admin
end end
end end
before do before do
Runtime::Feature.enable(:top_level_group_creation_enabled)
group.add_member(user, Resource::Members::AccessLevel::OWNER) group.add_member(user, Resource::Members::AccessLevel::OWNER)
Flow::Login.sign_in(as: user) Flow::Login.sign_in(as: user)
...@@ -34,8 +32,6 @@ module QA ...@@ -34,8 +32,6 @@ module QA
after do after do
user.remove_via_api! user.remove_via_api!
Runtime::Feature.disable(:top_level_group_creation_enabled)
end end
it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1882' do it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1882' do
......
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