Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
03588bcf
Commit
03588bcf
authored
Jul 30, 2021
by
Richard Chong
Committed by
Mark Lapierre
Jul 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E test for only/except MR rule.
parent
e6234a15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb
...owser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb
+81
-0
No files found.
qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb
0 → 100644
View file @
03588bcf
# frozen_string_literal: true
require
'faker'
module
QA
RSpec
.
describe
'Verify'
,
:runner
do
context
'When job is configured to only run on merge_request_events'
do
let
(
:mr_only_job_name
)
{
'mr_only_job'
}
let
(
:non_mr_only_job_name
)
{
'non_mr_only_job'
}
let
(
:executor
)
{
"qa-runner-
#{
Faker
::
Alphanumeric
.
alphanumeric
(
8
)
}
"
}
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'merge-request-only-job'
end
end
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
executor
runner
.
tags
=
[
executor
]
end
end
let!
(
:ci_file
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
(
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
#{
mr_only_job_name
}
:
script: echo 'OK'
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
#{
non_mr_only_job_name
}
:
script: echo 'OK'
rules:
- if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
YAML
}
]
)
end
end
let
(
:merge_request
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
description
=
Faker
::
Lorem
.
sentence
merge_request
.
target_new_branch
=
false
merge_request
.
file_name
=
'new.txt'
merge_request
.
file_content
=
Faker
::
Lorem
.
sentence
end
end
before
do
Flow
::
Login
.
sign_in
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
(
&
:click_pipeline_link
)
end
after
do
runner
.
remove_via_api!
project
.
remove_via_api!
end
it
'only runs the job configured to run on merge requests'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/170'
do
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
aggregate_failures
do
expect
(
pipeline
).
to
have_job
(
mr_only_job_name
)
expect
(
pipeline
).
to
have_no_job
(
non_mr_only_job_name
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment