Commit 9985486e authored by ddavison's avatar ddavison

Pare down create_project_with_auto_devops_spec

For now only test RBAC disabled
Remove superfluous statements that waste time
Signed-off-by: default avatarddavison <ddavison@gitlab.com>
parent 3395eacb
...@@ -11,163 +11,148 @@ module QA ...@@ -11,163 +11,148 @@ module QA
end end
describe 'Auto DevOps support', :orchestrated, :kubernetes, :quarantine do describe 'Auto DevOps support', :orchestrated, :kubernetes, :quarantine do
[true, false].each do |rbac| context 'when rbac is enabled' do
context "when rbac is #{rbac ? 'enabled' : 'disabled'}" do before(:all) do
before(:all) do login
login
@project = Resource::Project.fabricate! do |p|
p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops'
p.description = 'Project with Auto DevOps'
end
# Disable code_quality check in Auto DevOps pipeline as it takes
# too long and times out the test
Resource::CiVariable.fabricate! do |resource|
resource.project = @project
resource.key = 'CODE_QUALITY_DISABLED'
resource.value = '1'
end
# Create Auto DevOps compatible repo @project = Resource::Project.fabricate! do |p|
Resource::Repository::ProjectPush.fabricate! do |push| p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops'
push.project = @project p.description = 'Project with Auto DevOps'
push.directory = Pathname end
.new(__dir__)
.join('../../../../../fixtures/auto_devops_rack')
push.commit_message = 'Create Auto DevOps compatible rack application'
end
# Create and connect K8s cluster
@cluster = Service::KubernetesCluster.new(rbac: rbac).create!
Resource::KubernetesCluster.fabricate! do |cluster|
cluster.project = @project
cluster.cluster = @cluster
cluster.install_helm_tiller = true
cluster.install_ingress = true
cluster.install_prometheus = true
cluster.install_runner = true
end
@project.visit! # Disable code_quality check in Auto DevOps pipeline as it takes
Page::Project::Menu.perform(&:click_ci_cd_settings) # too long and times out the test
Page::Project::Settings::CICD.perform do |p| Resource::CiVariable.fabricate! do |resource|
p.enable_auto_devops resource.project = @project
end resource.key = 'CODE_QUALITY_DISABLED'
resource.value = '1'
end end
after(:all) do # Create Auto DevOps compatible repo
@cluster&.remove! Resource::Repository::ProjectPush.fabricate! do |push|
push.project = @project
push.directory = Pathname
.new(__dir__)
.join('../../../../../fixtures/auto_devops_rack')
push.commit_message = 'Create Auto DevOps compatible rack application'
end end
before do # Create and connect K8s cluster
login @cluster = Service::KubernetesCluster.new(rbac: true).create!
Resource::KubernetesCluster.fabricate! do |cluster|
cluster.project = @project
cluster.cluster = @cluster
cluster.install_helm_tiller = true
cluster.install_ingress = true
cluster.install_prometheus = true
cluster.install_runner = true
end end
end
it 'runs auto devops' do after(:all) do
@project.visit! @cluster&.remove!
Page::Project::Menu.perform(&:click_ci_cd_pipelines) end
Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline| it 'runs auto devops' do
pipeline.go_to_job('build') @project.visit!
end Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Job::Show.perform do |job| Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline)
expect(job).to be_successful(timeout: 600)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('build')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
Page::Project::Pipeline::Show.perform do |pipeline| job.click_element(:pipeline_path)
pipeline.go_to_job('test') end
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('test')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
Page::Project::Pipeline::Show.perform do |pipeline| job.click_element(:pipeline_path)
pipeline.go_to_job('production') end
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 1200)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('production')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 1200)
Page::Project::Menu.perform(&:click_operations_environments) job.click_element(:pipeline_path)
Page::Project::Operations::Environments::Index.perform do |index|
index.go_to_environment('production')
end
Page::Project::Operations::Environments::Show.perform do |show|
show.view_deployment do
expect(page).to have_content('Hello World!')
end
end
end end
it 'user sets application secret variable and Auto DevOps passes it to container' do Page::Project::Menu.perform(&:click_operations_environments)
# Set an application secret CI variable (prefixed with K8S_SECRET_) Page::Project::Operations::Environments::Index.perform do |index|
Resource::CiVariable.fabricate! do |resource| index.go_to_environment('production')
resource.project = @project end
resource.key = 'K8S_SECRET_OPTIONAL_MESSAGE' Page::Project::Operations::Environments::Show.perform do |show|
resource.value = 'You can see this application secret' show.view_deployment do
expect(page).to have_content('Hello World!')
end end
end
end
# Our current Auto DevOps implementation won't update the production it 'user sets application secret variable and Auto DevOps passes it to container' do
# app if we only update a CI variable with no code change. # Set an application secret CI variable (prefixed with K8S_SECRET_)
# Resource::CiVariable.fabricate! do |resource|
# Workaround: push new code and use the resultant pipeline. resource.project = @project
Resource::Repository::ProjectPush.fabricate! do |push| resource.key = 'K8S_SECRET_OPTIONAL_MESSAGE'
push.project = @project resource.value = 'You can see this application secret'
push.commit_message = 'Force a Deployment change by pushing new code' end
push.file_name = 'new_file.txt'
push.file_content = 'new file contents'
end
@project.visit! # Our current Auto DevOps implementation won't update the production
Page::Project::Menu.perform(&:click_ci_cd_pipelines) # app if we only update a CI variable with no code change.
Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline) #
# Workaround: push new code and use the resultant pipeline.
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = @project
push.commit_message = 'Force a Deployment change by pushing new code'
push.file_name = 'new_file.txt'
push.file_content = 'new file contents'
end
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Menu.perform(&:click_ci_cd_pipelines)
pipeline.go_to_job('build') Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline)
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('build')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
Page::Project::Pipeline::Show.perform do |pipeline| job.click_element(:pipeline_path)
pipeline.go_to_job('test') end
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('test')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 600)
Page::Project::Pipeline::Show.perform do |pipeline| job.click_element(:pipeline_path)
pipeline.go_to_job('production') end
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 1200)
job.click_element(:pipeline_path) Page::Project::Pipeline::Show.perform do |pipeline|
end pipeline.go_to_job('production')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 1200)
end
Page::Project::Menu.perform(&:click_operations_environments) Page::Project::Menu.perform(&:click_operations_environments)
Page::Project::Operations::Environments::Index.perform do |index| Page::Project::Operations::Environments::Index.perform do |index|
index.go_to_environment('production') index.go_to_environment('production')
end end
Page::Project::Operations::Environments::Show.perform do |show| Page::Project::Operations::Environments::Show.perform do |show|
show.view_deployment do show.view_deployment do
expect(page).to have_content('Hello World!') expect(page).to have_content('Hello World!')
expect(page).to have_content('You can see this application secret') expect(page).to have_content('You can see this application secret')
end
end end
end end
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