BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6ec2730f
Commit
6ec2730f
authored
May 25, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test ProxyFlightTime middleware
parent
c049534d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
proxy_flight_time_spec.rb
spec/lib/gitlab/middleware/proxy_flight_time_spec.rb
+31
-0
No files found.
spec/lib/gitlab/middleware/proxy_flight_time_spec.rb
0 → 100644
View file @
6ec2730f
require
'spec_helper'
describe
Gitlab
::
Middleware
::
ProxyFlightTime
do
let
(
:app
)
{
double
(
:app
)
}
let
(
:middleware
)
{
described_class
.
new
(
app
)
}
let
(
:env
)
{
{}
}
let
(
:transaction
)
{
double
(
:transaction
)
}
before
{
expect
(
app
).
to
receive
(
:call
).
with
(
env
).
and_return
(
'yay'
)
}
describe
'#call'
do
it
'calls the app when metrics are disabled'
do
expect
(
Gitlab
::
Metrics
).
to
receive
(
:current_transaction
).
and_return
(
nil
)
expect
(
middleware
.
call
(
env
)).
to
eq
(
'yay'
)
end
context
'when metrics are enabled'
do
before
{
allow
(
Gitlab
::
Metrics
).
to
receive
(
:current_transaction
).
and_return
(
transaction
)
}
it
'calls the app when metrics are enabled but no timing header is found'
do
expect
(
middleware
.
call
(
env
)).
to
eq
(
'yay'
)
end
it
'sets proxy_flight_time and calls the app when the header is present'
do
env
[
'HTTP_GITLAB_WORHORSE_PROXY_START'
]
=
'123'
expect
(
transaction
).
to
receive
(
:set
).
with
(
:proxy_flight_time
,
an_instance_of
(
Float
))
expect
(
middleware
.
call
(
env
)).
to
eq
(
'yay'
)
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