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
267ce448
Commit
267ce448
authored
Jun 02, 2021
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement search argument in RunnersResolver
parent
67a52000
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
app/graphql/resolvers/ci/runners_resolver.rb
app/graphql/resolvers/ci/runners_resolver.rb
+4
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/graphql/resolvers/ci/runners_resolver_spec.rb
spec/graphql/resolvers/ci/runners_resolver_spec.rb
+34
-4
No files found.
app/graphql/resolvers/ci/runners_resolver.rb
View file @
267ce448
...
...
@@ -17,6 +17,10 @@ module Resolvers
required:
false
,
description:
'Filter by tags associated with the runner (comma-separated or array).'
argument
:search
,
GraphQL
::
STRING_TYPE
,
required:
false
,
description:
'Filter by text present in token or description fields.'
argument
:sort
,
::
Types
::
Ci
::
RunnerSortEnum
,
required:
false
,
description:
'Sort order of results.'
...
...
doc/api/graphql/reference/index.md
View file @
267ce448
...
...
@@ -336,6 +336,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"queryrunnerssearch"
></a>
`search`
|
[
`String`
](
#string
)
| Filter by text present in token or description fields. |
|
<a
id=
"queryrunnerssort"
></a>
`sort`
|
[
`CiRunnerSort`
](
#cirunnersort
)
| Sort order of results. |
|
<a
id=
"queryrunnersstatus"
></a>
`status`
|
[
`CiRunnerStatus`
](
#cirunnerstatus
)
| Filter runners by status. |
|
<a
id=
"queryrunnerstaglist"
></a>
`tagList`
|
[
`[String!]`
](
#string
)
| Filter by tags associated with the runner (comma-separated or array). |
...
...
spec/graphql/resolvers/ci/runners_resolver_spec.rb
View file @
267ce448
...
...
@@ -10,15 +10,15 @@ RSpec.describe Resolvers::Ci::RunnersResolver do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
let_it_be
(
:inactive_project_runner
)
do
create
(
:ci_runner
,
:project
,
projects:
[
project
],
active:
false
,
contacted_at:
1
.
minute
.
ago
,
tag_list:
%w(project_runner)
)
create
(
:ci_runner
,
:project
,
projects:
[
project
],
description:
'inactive project runner'
,
token:
'abcdef'
,
active:
false
,
contacted_at:
1
.
minute
.
ago
,
tag_list:
%w(project_runner)
)
end
let_it_be
(
:offline_project_runner
)
do
create
(
:ci_runner
,
:project
,
projects:
[
project
],
contacted_at:
1
.
day
.
ago
,
tag_list:
%w(project_runner active_runner)
)
create
(
:ci_runner
,
:project
,
projects:
[
project
],
description:
'offline project runner'
,
token:
'defghi'
,
contacted_at:
1
.
day
.
ago
,
tag_list:
%w(project_runner active_runner)
)
end
let_it_be
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
group
],
contacted_at:
1
.
second
.
ago
)
}
let_it_be
(
:instance_runner
)
{
create
(
:ci_runner
,
:instance
,
contacted_at:
2
.
minutes
.
ago
,
tag_list:
%w(instance_runner active_runner)
)
}
let_it_be
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
group
],
token:
'mnopqr'
,
description:
'group runner'
,
contacted_at:
1
.
second
.
ago
)
}
let_it_be
(
:instance_runner
)
{
create
(
:ci_runner
,
:instance
,
description:
'shared runner'
,
token:
'stuvxz'
,
contacted_at:
2
.
minutes
.
ago
,
tag_list:
%w(instance_runner active_runner)
)
}
describe
'#resolve'
do
subject
{
resolve
(
described_class
,
ctx:
{
current_user:
user
},
args:
args
).
items
.
to_a
}
...
...
@@ -132,5 +132,35 @@ RSpec.describe Resolvers::Ci::RunnersResolver do
end
end
end
context
'when text is filtered'
do
let
(
:args
)
do
{
search:
search_term
}
end
context
'to "project"'
do
let
(
:search_term
)
{
'project'
}
it
'returns both project runners'
do
is_expected
.
to
contain_exactly
(
inactive_project_runner
,
offline_project_runner
)
end
end
context
'to "group"'
do
let
(
:search_term
)
{
'group'
}
it
'returns group runner'
do
is_expected
.
to
contain_exactly
(
group_runner
)
end
end
context
'to "def"'
do
let
(
:search_term
)
{
'def'
}
it
'returns runners containing term in token'
do
is_expected
.
to
contain_exactly
(
inactive_project_runner
,
offline_project_runner
)
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