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
a68822c4
Commit
a68822c4
authored
Sep 08, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve runtime of usage data core specs
parent
178deb90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+9
-19
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+2
-0
No files found.
spec/lib/gitlab/usage_data_spec.rb
View file @
a68822c4
...
...
@@ -12,14 +12,14 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
describe
'.uncached_data'
do
describe
'.usage_activity_by_stage'
do
it
'includes usage_activity_by_stage data'
do
uncached_data
=
described_class
.
uncached_data
subject
{
described_class
.
uncached_data
}
expect
(
uncached_data
).
to
include
(
:usage_activity_by_stage
)
expect
(
uncached_data
).
to
include
(
:usage_activity_by_stage_monthly
)
expect
(
uncached_data
[
:usage_activity_by_stage
])
it
'includes usage_activity_by_stage data'
do
is_expected
.
to
include
(
:usage_activity_by_stage
)
is_expected
.
to
include
(
:usage_activity_by_stage_monthly
)
expect
(
subject
[
:usage_activity_by_stage
])
.
to
include
(
:configure
,
:create
,
:manage
,
:monitor
,
:plan
,
:release
,
:verify
)
expect
(
uncached_data
[
:usage_activity_by_stage_monthly
])
expect
(
subject
[
:usage_activity_by_stage_monthly
])
.
to
include
(
:configure
,
:create
,
:manage
,
:monitor
,
:plan
,
:release
,
:verify
)
end
...
...
@@ -34,15 +34,13 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
described_class
).
to
receive
(
:clear_memoization
).
with
(
key
)
end
described_class
.
uncached_data
subject
end
it
'merge_requests_users is included only in montly counters'
do
uncached_data
=
described_class
.
uncached_data
expect
(
uncached_data
[
:usage_activity_by_stage
][
:create
])
expect
(
subject
[
:usage_activity_by_stage
][
:create
])
.
not_to
include
(
:merge_requests_users
)
expect
(
uncached_data
[
:usage_activity_by_stage_monthly
][
:create
])
expect
(
subject
[
:usage_activity_by_stage_monthly
][
:create
])
.
to
include
(
:merge_requests_users
)
end
end
...
...
@@ -401,10 +399,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
UsageDataHelpers
::
COUNTS_KEYS
-
count_data
.
keys
).
to
be_empty
end
it
'gathers usage counts monthly hash'
do
expect
(
subject
[
:counts_monthly
]).
to
be_an
(
Hash
)
end
it
'gathers usage counts correctly'
do
count_data
=
subject
[
:counts
]
...
...
@@ -492,10 +486,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
)
end
it
'gathers topology data'
do
expect
(
subject
.
keys
).
to
include
(
:topology
)
end
context
'with existing container expiration policies'
do
let_it_be
(
:disabled
)
{
create
(
:container_expiration_policy
,
enabled:
false
)
}
let_it_be
(
:enabled
)
{
create
(
:container_expiration_policy
,
enabled:
true
)
}
...
...
spec/support/helpers/usage_data_helpers.rb
View file @
a68822c4
...
...
@@ -138,6 +138,7 @@ module UsageDataHelpers
USAGE_DATA_KEYS
=
%i(
active_user_count
counts
counts_monthly
recorded_at
edition
version
...
...
@@ -162,6 +163,7 @@ module UsageDataHelpers
web_ide_clientside_preview_enabled
ingress_modsecurity_enabled
object_store
topology
)
.
freeze
def
stub_usage_data_connections
...
...
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