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
5071a971
Commit
5071a971
authored
Jan 19, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename remaining project_metrics to be project_statistics
parent
0828f69d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
22 deletions
+10
-22
app/models/ee/project.rb
app/models/ee/project.rb
+0
-2
app/workers/clear_shared_runners_minutes_worker.rb
app/workers/clear_shared_runners_minutes_worker.rb
+1
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+0
-1
spec/models/ee/project_spec.rb
spec/models/ee/project_spec.rb
+2
-4
spec/models/project_metrics_spec.rb
spec/models/project_metrics_spec.rb
+0
-7
spec/services/update_build_minutes_service_spec.rb
spec/services/update_build_minutes_service_spec.rb
+4
-4
spec/workers/clear_shared_runners_minutes_worker_spec.rb
spec/workers/clear_shared_runners_minutes_worker_spec.rb
+3
-3
No files found.
app/models/ee/project.rb
View file @
5071a971
...
...
@@ -14,8 +14,6 @@ module EE
delegate
:actual_shared_runners_minutes_limit
,
:shared_runners_minutes_used?
,
to: :namespace
has_one
:project_metrics
,
dependent: :destroy
end
def
shared_runners_available?
...
...
app/workers/clear_shared_runners_minutes_worker.rb
View file @
5071a971
...
...
@@ -7,7 +7,7 @@ class ClearSharedRunnersMinutesWorker
def
perform
return
unless
try_obtain_lease
Project
Metr
ics
.
update_all
(
Project
Statist
ics
.
update_all
(
shared_runners_minutes:
0
,
shared_runners_minutes_last_reset:
Time
.
now
)
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
5071a971
...
...
@@ -212,7 +212,6 @@ project:
-
path_locks
-
approver_groups
-
route
-
project_metrics
-
statistics
award_emoji
:
-
awardable
...
...
spec/models/ee/project_spec.rb
View file @
5071a971
...
...
@@ -2,10 +2,8 @@ require 'spec_helper'
describe
Project
,
models:
true
do
describe
'associations'
do
it
{
is_expected
.
to
have_one
(
:project_metrics
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes
).
to
(
:project_metrics
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_last_reset
).
to
(
:project_metrics
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes
).
to
(
:project_statistics
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_last_reset
).
to
(
:project_statistics
)
}
it
{
is_expected
.
to
delegate_method
(
:actual_shared_runners_minutes_limit
).
to
(
:namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_limit_enabled?
).
to
(
:namespace
)
}
...
...
spec/models/project_metrics_spec.rb
deleted
100644 → 0
View file @
0828f69d
require
'spec_helper'
describe
ProjectMetrics
,
models:
true
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
end
spec/services/update_build_minutes_service_spec.rb
View file @
5071a971
...
...
@@ -19,7 +19,7 @@ describe UpdateBuildMinutesService, services: true do
it
"creates a metrics and sets duration"
do
subject
expect
(
project
.
project_
metr
ics
.
reload
.
shared_runners_minutes
).
expect
(
project
.
project_
statist
ics
.
reload
.
shared_runners_minutes
).
to
eq
(
build
.
duration
.
to_i
)
expect
(
namespace
.
namespace_statistics
.
reload
.
shared_runners_minutes
).
...
...
@@ -28,14 +28,14 @@ describe UpdateBuildMinutesService, services: true do
context
'when metrics are created'
do
before
do
project
.
create_project_
metr
ics
(
shared_runners_minutes:
100
)
project
.
create_project_
statist
ics
(
shared_runners_minutes:
100
)
namespace
.
create_namespace_metrics
(
shared_runners_minutes:
100
)
end
it
"updates metrics and adds duration"
do
subject
expect
(
project
.
project_
metr
ics
.
reload
.
shared_runners_minutes
).
expect
(
project
.
project_
statist
ics
.
reload
.
shared_runners_minutes
).
to
eq
(
100
+
build
.
duration
.
to_i
)
expect
(
namespace
.
namespace_statistics
.
reload
.
shared_runners_minutes
).
...
...
@@ -50,7 +50,7 @@ describe UpdateBuildMinutesService, services: true do
it
"does not create metrics"
do
subject
expect
(
project
.
project_
metr
ics
).
to
be_nil
expect
(
project
.
project_
statist
ics
).
to
be_nil
expect
(
namespace
.
namespace_statistics
).
to
be_nil
end
end
...
...
spec/workers/clear_shared_runners_minutes_worker_spec.rb
View file @
5071a971
...
...
@@ -12,18 +12,18 @@ describe ClearSharedRunnersMinutesWorker do
subject
{
worker
.
perform
}
context
'when project metrics are defined'
do
let!
(
:project_
metrics
)
{
create
(
:project_metr
ics
,
shared_runners_minutes:
100
)
}
let!
(
:project_
statistics
)
{
create
(
:project_statist
ics
,
shared_runners_minutes:
100
)
}
it
'clears counters'
do
subject
expect
(
project_
metr
ics
.
reload
.
shared_runners_minutes
).
to
be_zero
expect
(
project_
statist
ics
.
reload
.
shared_runners_minutes
).
to
be_zero
end
it
'resets timer'
do
subject
expect
(
project_
metr
ics
.
reload
.
shared_runners_minutes_last_reset
).
to
be_like_time
(
Time
.
now
)
expect
(
project_
statist
ics
.
reload
.
shared_runners_minutes_last_reset
).
to
be_like_time
(
Time
.
now
)
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