summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb')
-rw-r--r--qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb81
1 files changed, 81 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb
new file mode 100644
index 00000000000..6ce395affc7
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb
@@ -0,0 +1,81 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Package', :orchestrated, :packages do
+ describe 'Terraform Module Registry' do
+ include Runtime::Fixtures
+
+ let(:group) { Resource::Group.fabricate_via_api! }
+
+ let(:imported_project) do
+ Resource::ProjectImportedFromURL.fabricate_via_browser_ui! do |project|
+ project.name = 'terraform-module-test'
+ project.group = group
+ project.gitlab_repository_path = 'https://gitlab.com/mattkasa/terraform-module-test.git'
+ end
+ end
+
+ let(:runner) do
+ Resource::Runner.fabricate! do |runner|
+ runner.name = "qa-runner-#{Time.now.to_i}"
+ runner.tags = ["runner-for-#{imported_project.name}"]
+ runner.executor = :docker
+ runner.project = imported_project
+ runner.token = group.reload!.runners_token
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+
+ imported_project
+ runner
+ end
+
+ after do
+ runner.remove_via_api!
+ end
+
+ it 'publishes a module', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/371583' do
+ Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ terraform_module_yaml = ERB.new(
+ read_fixture('package_managers/terraform', 'module_upload.yaml.erb')
+ ).result(binding)
+ commit.project = imported_project
+ commit.commit_message = 'Add gitlab-ci.yaml file'
+ commit.update_files([
+ {
+ file_path: '.gitlab-ci.yml',
+ content: terraform_module_yaml
+ }
+ ]
+ )
+ end
+ end
+
+ Resource::Tag.fabricate_via_api! do |tag|
+ tag.project = imported_project
+ tag.ref = imported_project.default_branch
+ tag.name = "1.0.0"
+ end
+
+ Flow::Pipeline.visit_latest_pipeline
+
+ Page::Project::Pipeline::Show.perform do |pipeline|
+ pipeline.click_job('upload')
+ end
+
+ Page::Project::Job::Show.perform do |job|
+ expect(job).to be_successful(timeout: 800)
+ end
+
+ Page::Project::Menu.perform(&:go_to_infrastructure_registry)
+
+ Page::Project::Packages::Index.perform do |index|
+ expect(index).to have_module("#{imported_project.name}/local")
+ end
+ end
+ end
+ end
+end