Commit 4a40c6b1 authored by Dan Davison's avatar Dan Davison Committed by Walmyr Lima e Silva Filho

Promote pipeline spec to smoke test

Refactor test setup and fabrication

Add name to fabricated project

Remove :orchestrated and keep :docker

Add wait parameter to Pipeline show page

Remove superfluous expectations
Replace hard-sleep with wait: 30 within be_running
Register runner with executor name

Runner tags needs an array
parent b25b6a8f
...@@ -30,9 +30,9 @@ module QA::Page ...@@ -30,9 +30,9 @@ module QA::Page
element :pipeline_badges element :pipeline_badges
end end
def running? def running?(wait: 0)
within('.ci-header-container') do within('.ci-header-container') do
page.has_content?('running') page.has_content?('running', wait: wait)
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Verify', :orchestrated, :docker do context 'Verify', :docker do
describe 'Pipeline creation and processing' do describe 'Pipeline creation and processing' do
let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:executor) { "qa-runner-#{Time.now.to_i}" }
after do let(:project) do
Service::DockerRun::GitlabRunner.new(executor).remove! Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-pipeline'
end end
it 'users creates a pipeline which gets processed' do
Flow::Login.sign_in
project = Resource::Project.fabricate! do |project|
project.name = 'project-with-pipelines'
project.description = 'Project with CI/CD Pipelines.'
end end
before do
Resource::Runner.fabricate! do |runner| Resource::Runner.fabricate! do |runner|
runner.project = project runner.project = project
runner.name = executor runner.name = executor
runner.tags = %w[qa test] runner.tags = [executor]
end
end
after do
Service::DockerRun::GitlabRunner.new(executor).remove!
end end
Resource::Repository::ProjectPush.fabricate! do |push| it 'users creates a pipeline which gets processed', :smoke do
push.project = project Flow::Login.sign_in
push.file_name = '.gitlab-ci.yml'
push.commit_message = 'Add .gitlab-ci.yml' Resource::Repository::Commit.fabricate_via_api! do |commit|
push.file_content = <<~EOF commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files(
[
{
file_path: '.gitlab-ci.yml',
content: <<~YAML
test-success: test-success:
tags: tags:
- qa - #{executor}
- test
script: echo 'OK' script: echo 'OK'
test-failure: test-failure:
tags: tags:
- qa - #{executor}
- test
script: script:
- echo 'FAILURE' - echo 'FAILURE'
- exit 1 - exit 1
test-tags: test-tags:
tags: tags:
- qa - invalid
- docker
script: echo 'NOOP' script: echo 'NOOP'
test-artifacts: test-artifacts:
tags: tags:
- qa - #{executor}
- test
script: mkdir my-artifacts; echo "CONTENTS" > my-artifacts/artifact.txt script: mkdir my-artifacts; echo "CONTENTS" > my-artifacts/artifact.txt
artifacts: artifacts:
paths: paths:
- my-artifacts/ - my-artifacts/
EOF YAML
}
]
)
end.project.visit! end.project.visit!
expect(page).to have_content('Add .gitlab-ci.yml')
Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Menu.perform(&:click_ci_cd_pipelines)
expect(page).to have_content('All 1')
expect(page).to have_content('Add .gitlab-ci.yml')
puts 'Waiting for the runner to process the pipeline'
sleep 15 # Runner should process all jobs within 15 seconds.
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Pipeline::Show.perform do |pipeline|
expect(pipeline).to be_running expect(pipeline).to be_running(wait: 30)
expect(pipeline).to have_build('test-success', status: :success) expect(pipeline).to have_build('test-success', status: :success)
expect(pipeline).to have_build('test-failure', status: :failed) expect(pipeline).to have_build('test-failure', status: :failed)
expect(pipeline).to have_build('test-tags', status: :pending) expect(pipeline).to have_build('test-tags', status: :pending)
......
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