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
326fdcbf
Commit
326fdcbf
authored
Jan 19, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec failures
parent
c1d5704f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
7 deletions
+55
-7
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/services/ee/ci/register_build_service.rb
app/services/ee/ci/register_build_service.rb
+1
-1
app/services/update_build_minutes_service.rb
app/services/update_build_minutes_service.rb
+1
-1
app/views/groups/pipeline_quota/index.html.haml
app/views/groups/pipeline_quota/index.html.haml
+1
-1
app/views/shared/_shared_runners_minutes_limit.html.haml
app/views/shared/_shared_runners_minutes_limit.html.haml
+1
-1
spec/models/group_spec.rb
spec/models/group_spec.rb
+8
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+42
-0
No files found.
app/models/namespace.rb
View file @
326fdcbf
...
@@ -182,7 +182,7 @@ class Namespace < ActiveRecord::Base
...
@@ -182,7 +182,7 @@ class Namespace < ActiveRecord::Base
end
end
def
shared_runners_enabled?
def
shared_runners_enabled?
projects
.
w
here
(
shared_runners_enabled:
true
)
.
any?
projects
.
w
ith_shared_runners
.
any?
end
end
def
full_name
def
full_name
...
...
app/services/ee/ci/register_build_service.rb
View file @
326fdcbf
...
@@ -13,7 +13,7 @@ module EE
...
@@ -13,7 +13,7 @@ module EE
# select projects which have allowed number of shared runner minutes or are public
# select projects which have allowed number of shared runner minutes or are public
super
.
super
.
where
(
"projects.visibility_level=? OR (
#{
builds_check_limit
.
to_sql
}
)=1"
,
where
(
"projects.visibility_level=? OR (
#{
builds_check_limit
.
to_sql
}
)=1"
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)
::
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
end
def
builds_check_limit
def
builds_check_limit
...
...
app/services/update_build_minutes_service.rb
View file @
326fdcbf
app/views/groups/pipeline_quota/index.html.haml
View file @
326fdcbf
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
=
project
.
shared_runners_minutes
=
project
.
shared_runners_minutes
-
if
@projects
.
blank?
-
if
@projects
.
blank?
%tr
%tr
%td
{
colspan:
2
}
%td
{
colspan:
2
}
.nothing-here-block
This group has no projects which use shared runners
.nothing-here-block
This group has no projects which use shared runners
=
paginate
@projects
,
theme:
"gitlab"
=
paginate
@projects
,
theme:
"gitlab"
app/views/shared/_shared_runners_minutes_limit.html.haml
View file @
326fdcbf
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
-
has_limit
=
(
project
||
namespace
).
shared_runners_minutes_limit_enabled?
-
has_limit
=
(
project
||
namespace
).
shared_runners_minutes_limit_enabled?
-
can_see_status
=
project
.
nil?
||
can?
(
current_user
,
:create_pipeline
,
project
)
-
can_see_status
=
project
.
nil?
||
can?
(
current_user
,
:create_pipeline
,
project
)
-
if
cookies
[
:hide_shared_runner_quota_message
].
blank?
&&
has_limit
&&
namespace
.
shared_runners_minutes_used?
&&
can_see_status
-
if
cookies
[
:hide_shared_runner_quota_message
].
blank?
&&
has_limit
&&
namespace
.
shared_runners_minutes_used?
&&
can_see_status
.shared-runner-quota-message.alert.alert-warning.hidden-xs
{
data:
{
scope:
scope
}}
.shared-runner-quota-message.alert.alert-warning.hidden-xs
{
data:
{
scope:
scope
}
}
=
namespace
.
name
=
namespace
.
name
has exceeded their build minutes quota. Pipelines will not run anymore on shared runners.
has exceeded their build minutes quota. Pipelines will not run anymore on shared runners.
...
...
spec/models/group_spec.rb
View file @
326fdcbf
...
@@ -81,13 +81,19 @@ describe Group, models: true do
...
@@ -81,13 +81,19 @@ describe Group, models: true do
describe
'public_only'
do
describe
'public_only'
do
subject
{
described_class
.
public_only
.
to_a
}
subject
{
described_class
.
public_only
.
to_a
}
it
{
is_expected
.
to
eq
([
group
])
}
it
{
is_expected
.
to
eq
([
group
])
}
end
end
describe
'public_and_internal_only'
do
describe
'public_and_internal_only'
do
subject
{
described_class
.
public_and_internal_only
.
to_a
}
subject
{
described_class
.
public_and_internal_only
.
to_a
}
it
{
is_expected
.
to
match_array
([
group
,
internal_group
])
}
it
{
is_expected
.
to
match_array
([
group
,
internal_group
])
}
end
describe
'non_public_only'
do
subject
{
described_class
.
non_public_only
.
to_a
}
it
{
is_expected
.
to
match_array
([
private_group
,
internal_group
])
}
end
end
end
end
...
...
spec/models/project_spec.rb
View file @
326fdcbf
...
@@ -976,6 +976,26 @@ describe Project, models: true do
...
@@ -976,6 +976,26 @@ describe Project, models: true do
it
{
expect
(
project
.
builds_enabled?
).
to
be_truthy
}
it
{
expect
(
project
.
builds_enabled?
).
to
be_truthy
}
end
end
describe
'.with_shared_runners'
do
subject
{
Project
.
with_shared_runners
}
context
'when shared runners are enabled for project'
do
let!
(
:project
)
{
create
(
:empty_project
,
shared_runners_enabled:
true
)
}
it
"returns a project"
do
is_expected
.
to
eq
([
project
])
end
end
context
'when shared runners are disabled for project'
do
let!
(
:project
)
{
create
(
:empty_project
,
shared_runners_enabled:
false
)
}
it
"returns a project"
do
is_expected
.
to
eq
([
project
])
end
end
end
describe
'.cached_count'
,
caching:
true
do
describe
'.cached_count'
,
caching:
true
do
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let!
(
:project1
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
let!
(
:project1
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
...
@@ -1118,6 +1138,28 @@ describe Project, models: true do
...
@@ -1118,6 +1138,28 @@ describe Project, models: true do
end
end
end
end
describe
'#shared_runners'
do
let!
(
:runner
)
{
create
(
:ci_runner
,
:shared
)
}
subject
{
project
.
shared_runners
}
context
'when shared runners are enabled for project'
do
let!
(
:project
)
{
create
(
:empty_project
,
shared_runners_enabled:
true
)
}
it
"returns a list of shared runners"
do
is_expected
.
to
eq
([
runner
])
end
end
context
'when shared runners are disabled for project'
do
let!
(
:project
)
{
create
(
:empty_project
,
shared_runners_enabled:
false
)
}
it
"returns a empty list"
do
is_expected
.
to
be_nil
end
end
end
describe
'#visibility_level_allowed?'
do
describe
'#visibility_level_allowed?'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:project
,
:internal
)
}
...
...
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