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
f2531819
Commit
f2531819
authored
Jul 06, 2020
by
Alex Kalderimis
Committed by
Alex Kalderimis
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GlobalID in metrics
parent
6c504c83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
34 deletions
+20
-34
app/graphql/mutations/metrics/dashboard/annotations/delete.rb
...graphql/mutations/metrics/dashboard/annotations/delete.rb
+1
-2
spec/requests/api/graphql/mutations/metrics/dashboard/annotations/create_spec.rb
...ql/mutations/metrics/dashboard/annotations/create_spec.rb
+18
-31
spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb
...ql/mutations/metrics/dashboard/annotations/delete_spec.rb
+1
-1
No files found.
app/graphql/mutations/metrics/dashboard/annotations/delete.rb
View file @
f2531819
...
...
@@ -9,8 +9,7 @@ module Mutations
authorize
:delete_metrics_dashboard_annotation
argument
:id
,
GraphQL
::
ID_TYPE
,
argument
:id
,
::
Types
::
GlobalIDType
[
::
Metrics
::
Dashboard
::
Annotation
],
required:
true
,
description:
'The global ID of the annotation to delete'
...
...
spec/requests/api/graphql/mutations/metrics/dashboard/annotations/create_spec.rb
View file @
f2531819
...
...
@@ -101,9 +101,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do
graphql_mutation
(
:create_annotation
,
variables
)
end
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
include
(
/is not a valid Global ID/
)
}
end
it_behaves_like
'an invalid argument to the mutation'
,
argument_name: :environment_id
end
end
end
...
...
@@ -190,9 +188,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do
graphql_mutation
(
:create_annotation
,
variables
)
end
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
include
(
/is not a valid Global ID/
)
}
end
it_behaves_like
'an invalid argument to the mutation'
,
argument_name: :cluster_id
end
end
...
...
@@ -213,35 +209,26 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do
it_behaves_like
'a mutation that returns top-level errors'
,
errors:
[
described_class
::
ANNOTATION_SOURCE_ARGUMENT_ERROR
]
end
context
'when a non-cluster or environment id is provided'
do
let
(
:gid
)
{
{
environment_id:
project
.
to_global_id
.
to_s
}
}
let
(
:mutation
)
do
variables
=
{
starting_at:
starting_at
,
ending_at:
ending_at
,
dashboard_path:
dashboard_path
,
description:
description
}.
merge!
(
gid
)
graphql_mutation
(
:create_annotation
,
variables
)
end
before
do
project
.
add_developer
(
current_user
)
end
[
:environment_id
,
:cluster_id
].
each
do
|
arg_name
|
context
"when
#{
arg_name
}
is given an ID of the wrong type"
do
let
(
:gid
)
{
global_id_of
(
project
)
}
let
(
:mutation
)
do
variables
=
{
starting_at:
starting_at
,
ending_at:
ending_at
,
dashboard_path:
dashboard_path
,
description:
description
,
arg_name
=>
gid
}
describe
'non-environment id'
do
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
include
(
/does not represent an instance of Environment/
)
}
graphql_mutation
(
:create_annotation
,
variables
)
end
end
describe
'non-cluster id'
do
let
(
:gid
)
{
{
cluster_id:
project
.
to_global_id
.
to_s
}
}
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
include
(
/does not represent an instance of Clusters::Cluster/
)
}
before
do
project
.
add_developer
(
current_user
)
end
it_behaves_like
'an invalid argument to the mutation'
,
argument_name:
arg_name
end
end
end
spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb
View file @
f2531819
...
...
@@ -36,7 +36,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Delete do
let
(
:variables
)
{
{
id:
GitlabSchema
.
id_from_object
(
project
).
to_s
}
}
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
eq
([
"
#{
variables
[
:id
]
}
is not a valid ID for
#{
annotation
.
class
}
."
]
)
}
let
(
:match_errors
)
{
contain_exactly
(
include
(
'invalid value for id'
)
)
}
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