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
899a7250
Commit
899a7250
authored
Apr 06, 2021
by
Tiffany Rea
Committed by
Sanad Liaquat
Apr 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E test cancel pipeline schedule when user is blocked
parent
125d7ef6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
0 deletions
+121
-0
qa/qa.rb
qa/qa.rb
+1
-0
qa/qa/resource/pipeline_schedules.rb
qa/qa/resource/pipeline_schedules.rb
+50
-0
qa/qa/resource/project.rb
qa/qa/resource/project.rb
+8
-0
qa/qa/resource/user.rb
qa/qa/resource/user.rb
+12
-0
qa/qa/specs/features/api/4_verify/.gitkeep
qa/qa/specs/features/api/4_verify/.gitkeep
+0
-0
qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb
...ures/api/4_verify/cancel_pipeline_when_block_user_spec.rb
+50
-0
No files found.
qa/qa.rb
View file @
899a7250
...
...
@@ -98,6 +98,7 @@ module QA
autoload
:Design
,
'qa/resource/design'
autoload
:RegistryRepository
,
'qa/resource/registry_repository'
autoload
:Package
,
'qa/resource/package'
autoload
:PipelineSchedules
,
'qa/resource/pipeline_schedules'
module
KubernetesCluster
autoload
:Base
,
'qa/resource/kubernetes_cluster/base'
...
...
qa/qa/resource/pipeline_schedules.rb
0 → 100644
View file @
899a7250
# frozen_string_literal: true
module
QA
module
Resource
class
PipelineSchedules
<
Base
attribute
:id
attribute
:ref
attribute
:description
# Cron schedule form "* * * * *"
# String of integers in order of "minute hour day-of-month month day-of-week"
attribute
:cron
attribute
:project
do
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'project-with-pipeline-schedule'
end
end
def
initialize
@cron
=
'0 * * * *'
# default to schedule at the beginning of the hour
@description
=
'QA test scheduling pipeline.'
@ref
=
project
.
default_branch
end
def
api_get_path
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
id
}
"
end
def
api_post_path
"/projects/
#{
project
.
id
}
/pipeline_schedules"
end
def
api_post_body
{
description:
description
,
ref:
ref
,
cron:
cron
}
end
private
def
resource_web_url
(
resource
)
resource
=
resource
.
has_key?
(
:owner
)
?
resource
.
fetch
(
:owner
)
:
resource
super
end
end
end
end
qa/qa/resource/project.rb
View file @
899a7250
...
...
@@ -179,6 +179,10 @@ module QA
"
#{
api_get_path
}
/pipelines"
end
def
api_pipeline_schedules_path
"
#{
api_get_path
}
/pipeline_schedules"
end
def
api_put_path
"/projects/
#{
id
}
"
end
...
...
@@ -290,6 +294,10 @@ module QA
parse_body
(
get
(
Runtime
::
API
::
Request
.
new
(
api_client
,
api_pipelines_path
).
url
))
end
def
pipeline_schedules
parse_body
(
get
(
Runtime
::
API
::
Request
.
new
(
api_client
,
api_pipeline_schedules_path
).
url
))
end
private
def
transform_api_resource
(
api_resource
)
...
...
qa/qa/resource/user.rb
View file @
899a7250
...
...
@@ -118,6 +118,10 @@ module QA
'/users'
end
def
api_block_path
"/users/
#{
id
}
/block"
end
def
api_post_body
{
admin:
admin
,
...
...
@@ -143,6 +147,14 @@ module QA
end
end
def
block!
response
=
post
(
Runtime
::
API
::
Request
.
new
(
api_client
,
api_block_path
).
url
,
nil
)
unless
response
.
code
==
HTTP_STATUS_CREATED
raise
ResourceUpdateFailedError
,
"Failed to block user. Request returned (
#{
response
.
code
}
): `
#{
response
}
`."
end
end
private
def
ldap_post_body
...
...
qa/qa/specs/features/api/4_verify/.gitkeep
deleted
100644 → 0
View file @
125d7ef6
qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb
0 → 100644
View file @
899a7250
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Verify'
,
:requires_admin
do
describe
'When user is blocked'
do
let!
(
:admin_api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let!
(
:user_api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
user
)
}
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
api_client
=
admin_api_client
end
end
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'project-for-canceled-schedule'
end
end
before
do
project
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
Resource
::
PipelineSchedules
.
fabricate_via_api!
do
|
schedule
|
schedule
.
api_client
=
user_api_client
schedule
.
project
=
project
end
Support
::
Waiter
.
wait_until
{
!
pipeline_schedule
[
:id
].
nil?
&&
pipeline_schedule
[
:active
]
==
true
}
end
after
do
user
.
remove_via_api!
project
.
remove_via_api!
end
it
'pipeline schedule is canceled'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1730'
do
user
.
block!
expect
(
pipeline_schedule
[
:active
]).
not_to
be_truthy
,
"Expected schedule active state to be false - active state
#{
pipeline_schedule
[
:active
]
}
"
end
private
def
pipeline_schedule
project
.
pipeline_schedules
.
first
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