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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
9ead268c
Commit
9ead268c
authored
Nov 02, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more integration scenarios testing order. Also, fixed bug in the staging and test stages.
parent
85c448d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
17 deletions
+44
-17
lib/gitlab/cycle_analytics/events.rb
lib/gitlab/cycle_analytics/events.rb
+0
-2
lib/gitlab/cycle_analytics/query_config.rb
lib/gitlab/cycle_analytics/query_config.rb
+2
-2
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+42
-13
No files found.
lib/gitlab/cycle_analytics/events.rb
View file @
9ead268c
...
@@ -9,8 +9,6 @@ module Gitlab
...
@@ -9,8 +9,6 @@ module Gitlab
@fetcher
=
EventsFetcher
.
new
(
project:
project
,
from:
from
)
@fetcher
=
EventsFetcher
.
new
(
project:
project
,
from:
from
)
end
end
# TODO: backend pagination - specially for commits, etc...
def
issue_events
def
issue_events
@fetcher
.
fetch
(
stage: :issue
).
each
{
|
event
|
parse_event
(
event
)
}
@fetcher
.
fetch
(
stage: :issue
).
each
{
|
event
|
parse_event
(
event
)
}
end
end
...
...
lib/gitlab/cycle_analytics/query_config.rb
View file @
9ead268c
...
@@ -50,7 +50,7 @@ module Gitlab
...
@@ -50,7 +50,7 @@ module Gitlab
def
test
def
test
{
start_time_attrs:
mr_metrics_table
[
:latest_build_started_at
],
{
start_time_attrs:
mr_metrics_table
[
:latest_build_started_at
],
end_time_attrs:
mr_metrics_table
[
:latest_build_finished_at
],
end_time_attrs:
mr_metrics_table
[
:latest_build_finished_at
],
projections:
mr_metrics_table
[
:ci_commit_id
],
projections:
[
mr_metrics_table
[
:ci_commit_id
]
],
order:
mr_table
[
:created_at
]
order:
mr_table
[
:created_at
]
}
}
end
end
...
@@ -68,7 +68,7 @@ module Gitlab
...
@@ -68,7 +68,7 @@ module Gitlab
def
staging
def
staging
{
start_time_attrs:
mr_metrics_table
[
:merged_at
],
{
start_time_attrs:
mr_metrics_table
[
:merged_at
],
end_time_attrs:
mr_metrics_table
[
:first_deployed_to_production_at
],
end_time_attrs:
mr_metrics_table
[
:first_deployed_to_production_at
],
projections:
mr_metrics_table
[
:ci_commit_id
]
projections:
[
mr_metrics_table
[
:ci_commit_id
]
]
}
}
end
end
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
9ead268c
...
@@ -3,66 +3,95 @@ require 'spec_helper'
...
@@ -3,66 +3,95 @@ require 'spec_helper'
describe
'cycle analytics events'
do
describe
'cycle analytics events'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
before
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
milestone
=
create
(
:milestone
,
project:
project
)
3
.
times
{
create_cycle
}
issue
.
update
(
milestone:
milestone
)
create_merge_request_closing_issue
(
issue
)
merge_merge_requests_closing_issue
(
issue
)
deploy_master
deploy_master
login_as
(
user
)
login_as
(
user
)
end
end
it
'lists the issue events'
do
it
'lists the issue events
in the right order
'
do
get
namespace_project_cycle_analytics_issue_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_issue_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'events'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
end
end
it
'lists the plan events'
do
it
'lists the plan events
in the right order
'
do
get
namespace_project_cycle_analytics_plan_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_plan_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
first_date
=
DateTime
.
parse
(
json_response
[
'events'
].
first
[
'commit'
][
'authored_date'
])
last_date
=
DateTime
.
parse
(
json_response
[
'events'
].
last
[
'commit'
][
'authored_date'
])
expect
(
first_date
).
to
be
>
last_date
end
end
it
'lists the code events'
do
it
'lists the code events
in the right order
'
do
get
namespace_project_cycle_analytics_code_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_code_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'events'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
end
end
it
'lists the test events'
do
it
'lists the test events
in the right order
'
do
get
namespace_project_cycle_analytics_test_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_test_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
# TODO create builds
end
end
it
'lists the review events'
do
it
'lists the review events
in the right order
'
do
get
namespace_project_cycle_analytics_review_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_review_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'events'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
end
end
it
'lists the staging events'
do
it
'lists the staging events
in the right order
'
do
get
namespace_project_cycle_analytics_staging_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_staging_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
# TODO create builds
end
end
it
'lists the production events'
do
it
'lists the production events
in the right order
'
do
get
namespace_project_cycle_analytics_production_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_production_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
expect
(
json_response
[
'events'
]).
not_to
be_empty
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'events'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
end
end
end
end
def
json_response
def
json_response
JSON
.
parse
(
response
.
body
)
JSON
.
parse
(
response
.
body
)
end
end
def
create_cycle
issue
=
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
update
(
milestone:
milestone
)
create_merge_request_closing_issue
(
issue
)
merge_merge_requests_closing_issue
(
issue
)
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