Commit 52d8ed21 authored by Dan Davison's avatar Dan Davison

Merge branch 'ml-add-push-to-secondary-storage-test' into 'master'

Add E2E test to create repository on specific Praefect storage

See merge request gitlab-org/gitlab!27295
parents d3527803 f03554cf
......@@ -8,6 +8,7 @@ module QA
include Events::Project
include Members
attr_accessor :repository_storage # requires admin access
attr_writer :initialize_with_readme
attr_writer :auto_devops_enabled
attr_writer :visibility
......@@ -116,6 +117,8 @@ module QA
post_body[:path] = name
end
post_body[:repository_storage] = repository_storage if repository_storage
post_body
end
......
......@@ -15,7 +15,8 @@ module QA
# supports the given feature
SUPPORTED_FEATURES = {
git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2',
admin: 'QA_CAN_TEST_ADMIN_FEATURES'
admin: 'QA_CAN_TEST_ADMIN_FEATURES',
praefect: 'QA_CAN_TEST_PRAEFECT'
}.freeze
def supported_features
......@@ -26,6 +27,10 @@ module QA
ENV['QA_ADDITIONAL_REPOSITORY_STORAGE']
end
def praefect_repository_storage
ENV['QA_PRAEFECT_REPOSITORY_STORAGE']
end
def admin_password
ENV['GITLAB_ADMIN_PASSWORD']
end
......
......@@ -17,6 +17,28 @@ module QA
expect(project).to have_readme_content('This is a test project')
end
end
it 'pushes to a project using a specific Praefect repository storage', :smoke, :requires_admin, :requires_praefect, quarantine: { issue: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/276', type: :new } do
Flow::Login.sign_in_as_admin
project = Resource::Project.fabricate_via_api! do |storage_project|
storage_project.name = 'specific-repository-storage'
storage_project.repository_storage = QA::Runtime::Env.praefect_repository_storage
end
Resource::Repository::Push.fabricate! do |push|
push.repository_http_uri = project.repository_http_location.uri
push.file_name = 'README.md'
push.file_content = "# This is a test project named #{project.name}"
push.commit_message = 'Add README.md'
push.new_branch = true
end
project.visit!
expect(page).to have_content('README.md')
expect(page).to have_content("This is a test project named #{project.name}")
end
end
end
end
......@@ -271,6 +271,12 @@ describe QA::Runtime::Env do
env_key: 'QA_CAN_TEST_ADMIN_FEATURES',
default: true
it_behaves_like 'boolean method with parameter',
method: :can_test?,
param: :praefect,
env_key: 'QA_CAN_TEST_PRAEFECT',
default: true
it 'raises ArgumentError if feature is unknown' do
expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"')
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