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
a37843d1
Commit
a37843d1
authored
Mar 21, 2021
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add class for Non SQL data metrics API
Add specs for the API
parent
73c61ec1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
lib/api/usage_data_non_sql_metrics.rb
lib/api/usage_data_non_sql_metrics.rb
+25
-0
spec/requests/api/usage_data_non_sql_metrics_spec.rb
spec/requests/api/usage_data_non_sql_metrics_spec.rb
+38
-0
No files found.
lib/api/usage_data_non_sql_metrics.rb
0 → 100644
View file @
a37843d1
# frozen_string_literal: true
module
API
class
UsageDataNonSqlMetrics
<
::
API
::
Base
before
{
authenticate!
}
feature_category
:usage_ping
namespace
'usage_data'
do
before
do
forbidden!
(
'Invalid CSRF token is provided'
)
unlss
verified_request?
end
desc
'Get Non SQL usage ping metrics'
do
detail
'This feature was introduced in GitLab 13.11.0'
end
get
'non_sql_metrics'
do
data
=
Gitlab
::
UsageDataNonSqlMetrics
.
data
present
data
end
end
end
end
spec/requests/api/usage_data_non_sql_metrics_spec.rb
0 → 100644
View file @
a37843d1
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
API
::
UsageDataNonSqlMetrics
do
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'GET /usage_data/non_sql_metrics'
do
let
(
:endpoint
)
{
'/usage_data/non_sql_metrics'
}
context
'with authentication'
do
before
do
allow
(
Gitlab
::
RequestForgeryProtection
).
to
receive
(
:verified?
).
and_return
(
true
)
end
it
'returns non sql metrics'
do
get
api
(
endpoint
,
user
)
do
#TODO: Add check on response
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
context
'without CSRF token'
do
before
do
allow
(
Gitlab
::
RequestForgeryProtection
).
to
receive
(
:verified?
).
and_return
(
false
)
end
it
'returns forbidden'
do
get
api
(
endpoint
,
user
)
exepect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
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