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
30c6703f
Commit
30c6703f
authored
Dec 09, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs
parent
982d5a05
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
25 deletions
+10
-25
lib/gitlab/cycle_analytics/base_event_fetcher.rb
lib/gitlab/cycle_analytics/base_event_fetcher.rb
+4
-4
lib/gitlab/cycle_analytics/summary/commit.rb
lib/gitlab/cycle_analytics/summary/commit.rb
+1
-1
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
+1
-1
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
+3
-10
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
+1
-9
No files found.
lib/gitlab/cycle_analytics/base_event_fetcher.rb
View file @
30c6703f
...
...
@@ -19,6 +19,10 @@ module Gitlab
end
.
compact
end
def
order
@order
||
default_order
end
private
def
update_author!
...
...
@@ -37,10 +41,6 @@ module Gitlab
base_query
.
project
(
extract_diff_epoch
(
diff_fn
).
as
(
'total_time'
),
*
projections
).
order
(
order
.
desc
)
end
def
order
@order
||
default_order
end
def
default_order
@options
[
:start_time_attrs
].
is_a?
(
Array
)
?
@options
[
:start_time_attrs
].
first
:
@options
[
:start_time_attrs
]
end
...
...
lib/gitlab/cycle_analytics/summary/commit.rb
View file @
30c6703f
...
...
@@ -23,7 +23,7 @@ module Gitlab
cmd
<<
"--after=
#{
@from
.
iso8601
}
"
cmd
<<
sha
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
{
|
io
|
io
.
read
}
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
raise
IOError
,
output
unless
status
.
zero?
...
...
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
View file @
30c6703f
...
...
@@ -7,7 +7,7 @@ describe Gitlab::CycleAnalytics::PlanEventFetcher do
it_behaves_like
'default query config'
do
context
'no commits'
do
it
'does not blow up if there are no commits'
do
allow
_any_instance_of
(
Gitlab
::
CycleAnalytics
::
MetricsFetcher
).
to
receive
(
:events
).
and_return
([{}])
allow
(
event
).
to
receive
(
:event_result
).
and_return
([{}])
expect
{
event
.
fetch
}.
not_to
raise_error
end
...
...
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
View file @
30c6703f
require
'spec_helper'
shared_examples
'default query config'
do
let
(
:fetcher
)
do
Gitlab
::
CycleAnalytics
::
MetricsFetcher
.
new
(
project:
create
(
:empty_project
),
from:
1
.
day
.
ago
,
branch:
nil
,
stage:
stage_name
)
end
let
(
project
)
let
(
:event
)
{
described_class
.
new
(
project:
project
,
stage:
stage_name
,
options:
{})
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:event
)
{
described_class
.
new
(
project:
project
,
stage:
stage_name
,
options:
{
from:
1
.
day
.
ago
})
}
it
'has the stage attribute'
do
expect
(
event
.
nam
e
).
not_to
be_nil
expect
(
event
.
stag
e
).
not_to
be_nil
end
it
'has the projection attributes'
do
...
...
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
View file @
30c6703f
...
...
@@ -4,18 +4,10 @@ shared_examples 'base stage' do
let
(
:stage
)
{
described_class
.
new
(
project:
double
,
options:
{})
}
before
do
allow
_any_instance_of
(
Gitlab
::
CycleAnalytics
::
MetricsFetcher
).
to
receive
(
:median
).
and_return
(
1.12
)
allow
(
stage
).
to
receive
(
:median
).
and_return
(
1.12
)
allow_any_instance_of
(
Gitlab
::
CycleAnalytics
::
BaseEventFetcher
).
to
receive
(
:event_result
).
and_return
({})
end
it
'has the start attributes'
do
expect
(
stage
.
start_time_attrs
).
not_to
be_nil
end
it
'has the end attributes'
do
expect
(
stage
.
end_time_attrs
).
not_to
be_nil
end
it
'has the median data value'
do
expect
(
stage
.
median_data
[
:value
]).
not_to
be_nil
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