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
f1b43c1e
Commit
f1b43c1e
authored
May 17, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for unathrozied proxy_url
parent
c1e89492
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
spec/features/projects/environments/environments_spec.rb
spec/features/projects/environments/environments_spec.rb
+16
-0
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+10
-0
No files found.
spec/features/projects/environments/environments_spec.rb
View file @
f1b43c1e
...
...
@@ -42,6 +42,22 @@ feature 'Environments page', :js do
expect
(
page
).
to
have_content
(
'You don\'t have any environments right now'
)
end
end
context
'when cluster is not reachable'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
let!
(
:application_prometheus
)
{
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
}
before
do
allow_any_instance_of
(
Kubeclient
::
Client
).
to
receive
(
:proxy_url
).
with
(
anything
,
anything
,
anything
,
anything
).
and_raise
(
Kubeclient
::
HttpError
.
new
(
401
,
'Unauthorized'
,
nil
))
end
it
'should show one environment without error'
do
visit_environments
(
project
,
scope:
'available'
)
expect
(
page
).
to
have_css
(
'.environments-container'
)
expect
(
page
.
all
(
'.environment-name'
).
length
).
to
eq
(
1
)
end
end
end
describe
'with one stopped environment'
do
...
...
spec/models/clusters/applications/prometheus_spec.rb
View file @
f1b43c1e
...
...
@@ -85,6 +85,16 @@ describe Clusters::Applications::Prometheus do
it
'copies options and headers from kube client to proxy client'
do
expect
(
subject
.
prometheus_client
.
options
).
to
eq
(
kube_client
.
rest_client
.
options
.
merge
(
headers:
kube_client
.
headers
))
end
context
'when cluster is not reachable'
do
before
do
allow
(
kube_client
).
to
receive
(
:proxy_url
).
with
(
anything
,
anything
,
anything
,
anything
).
and_raise
(
Kubeclient
::
HttpError
.
new
(
401
,
'Unauthorized'
,
nil
))
end
it
'returns nil'
do
expect
(
subject
.
prometheus_client
).
to
be_nil
end
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