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
e937e539
Commit
e937e539
authored
Aug 11, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EE] Enable Timecop safe mode
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
8616c079
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
48 deletions
+26
-48
spec/features/boards/sidebar_spec.rb
spec/features/boards/sidebar_spec.rb
+5
-7
spec/features/groups/milestone_spec.rb
spec/features/groups/milestone_spec.rb
+4
-6
spec/lib/gitlab/git/storage/circuit_breaker_spec.rb
spec/lib/gitlab/git/storage/circuit_breaker_spec.rb
+1
-5
spec/lib/gitlab/metrics/requests_rack_middleware_spec.rb
spec/lib/gitlab/metrics/requests_rack_middleware_spec.rb
+6
-12
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+3
-7
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+4
-5
spec/serializers/analytics_build_entity_spec.rb
spec/serializers/analytics_build_entity_spec.rb
+2
-6
spec/spec_helper.rb
spec/spec_helper.rb
+1
-0
No files found.
spec/features/boards/sidebar_spec.rb
View file @
e937e539
...
@@ -15,11 +15,13 @@ describe 'Issue Boards', js: true do
...
@@ -15,11 +15,13 @@ describe 'Issue Boards', js: true do
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let
(
:card
)
{
find
(
'.board:nth-child(2)'
).
first
(
'.card'
)
}
let
(
:card
)
{
find
(
'.board:nth-child(2)'
).
first
(
'.card'
)
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
before
do
before
do
Timecop
.
freeze
stub_licensed_features
(
multiple_issue_assignees:
false
)
stub_licensed_features
(
multiple_issue_assignees:
false
)
project
.
add_master
(
user
)
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
sign_in
(
user
)
...
@@ -27,10 +29,6 @@ describe 'Issue Boards', js: true do
...
@@ -27,10 +29,6 @@ describe 'Issue Boards', js: true do
wait_for_requests
wait_for_requests
end
end
after
do
Timecop
.
return
end
it
'shows sidebar when clicking issue'
do
it
'shows sidebar when clicking issue'
do
click_card
(
card
)
click_card
(
card
)
...
...
spec/features/groups/milestone_spec.rb
View file @
e937e539
...
@@ -5,14 +5,12 @@ feature 'Group milestones', :js do
...
@@ -5,14 +5,12 @@ feature 'Group milestones', :js do
let!
(
:project
)
{
create
(
:project_empty_repo
,
group:
group
)
}
let!
(
:project
)
{
create
(
:project_empty_repo
,
group:
group
)
}
let
(
:user
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
let
(
:user
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
before
do
around
do
|
example
|
Timecop
.
freeze
Timecop
.
freeze
{
example
.
run
}
sign_in
(
user
)
end
end
after
do
before
do
Timecop
.
return
sign_in
(
user
)
end
end
context
'create a milestone'
do
context
'create a milestone'
do
...
...
spec/lib/gitlab/git/storage/circuit_breaker_spec.rb
View file @
e937e539
...
@@ -175,11 +175,7 @@ describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state:
...
@@ -175,11 +175,7 @@ describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state:
describe
'#track_storage_inaccessible'
do
describe
'#track_storage_inaccessible'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freeze
Timecop
.
freeze
{
example
.
run
}
example
.
run
Timecop
.
return
end
end
it
'records the failure time in redis'
do
it
'records the failure time in redis'
do
...
...
spec/lib/gitlab/metrics/requests_rack_middleware_spec.rb
View file @
e937e539
...
@@ -4,10 +4,6 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
...
@@ -4,10 +4,6 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
let
(
:app
)
{
double
(
'app'
)
}
let
(
:app
)
{
double
(
'app'
)
}
subject
{
described_class
.
new
(
app
)
}
subject
{
described_class
.
new
(
app
)
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
describe
'#call'
do
describe
'#call'
do
let
(
:status
)
{
100
}
let
(
:status
)
{
100
}
let
(
:env
)
{
{
'REQUEST_METHOD'
=>
'GET'
}
}
let
(
:env
)
{
{
'REQUEST_METHOD'
=>
'GET'
}
}
...
@@ -28,16 +24,14 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
...
@@ -28,16 +24,14 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
subject
.
call
(
env
)
subject
.
call
(
env
)
end
end
it
'measures execution time'
do
RSpec
::
Matchers
.
define
:a_positive_execution_time
do
execution_time
=
10
match
{
|
actual
|
actual
>
0
}
allow
(
app
).
to
receive
(
:call
)
do
|*
args
|
end
Timecop
.
freeze
(
execution_time
.
seconds
)
[
200
,
nil
,
nil
]
end
expect
(
described_class
).
to
receive_message_chain
(
:http_request_duration_seconds
,
:observe
).
with
({
status:
200
,
method:
'get'
},
execution_time
)
it
'measures execution time'
do
expect
(
described_class
).
to
receive_message_chain
(
:http_request_duration_seconds
,
:observe
).
with
({
status:
200
,
method:
'get'
},
a_positive_execution_time
)
subject
.
call
(
env
)
Timecop
.
scale
(
3600
)
{
subject
.
call
(
env
)
}
end
end
end
end
...
...
spec/models/issue_spec.rb
View file @
e937e539
...
@@ -57,18 +57,14 @@ describe Issue do
...
@@ -57,18 +57,14 @@ describe Issue do
end
end
describe
'#closed_at'
do
describe
'#closed_at'
do
after
do
Timecop
.
return
end
let!
(
:now
)
{
Timecop
.
freeze
(
Time
.
now
)
}
it
'sets closed_at to Time.now when issue is closed'
do
it
'sets closed_at to Time.now when issue is closed'
do
issue
=
create
(
:issue
,
state:
'opened'
)
issue
=
create
(
:issue
,
state:
'opened'
)
expect
(
issue
.
closed_at
).
to
be_nil
issue
.
close
issue
.
close
expect
(
issue
.
closed_at
).
to
eq
(
now
)
expect
(
issue
.
closed_at
).
to
be_present
end
end
end
end
...
...
spec/requests/api/internal_spec.rb
View file @
e937e539
...
@@ -229,13 +229,12 @@ describe API::Internal do
...
@@ -229,13 +229,12 @@ describe API::Internal do
describe
"POST /internal/allowed"
,
:clean_gitlab_redis_shared_state
do
describe
"POST /internal/allowed"
,
:clean_gitlab_redis_shared_state
do
context
"access granted"
do
context
"access granted"
do
before
do
around
do
|
example
|
project
.
team
<<
[
user
,
:developer
]
Timecop
.
freeze
{
example
.
run
}
Timecop
.
freeze
end
end
after
do
before
do
Timecop
.
return
project
.
team
<<
[
user
,
:developer
]
end
end
context
'with env passed as a JSON'
do
context
'with env passed as a JSON'
do
...
...
spec/serializers/analytics_build_entity_spec.rb
View file @
e937e539
...
@@ -13,12 +13,8 @@ describe AnalyticsBuildEntity do
...
@@ -13,12 +13,8 @@ describe AnalyticsBuildEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
before
do
around
do
|
example
|
Timecop
.
freeze
Timecop
.
freeze
{
example
.
run
}
end
after
do
Timecop
.
return
end
end
it
'contains the URL'
do
it
'contains the URL'
do
...
...
spec/spec_helper.rb
View file @
e937e539
...
@@ -83,6 +83,7 @@ RSpec.configure do |config|
...
@@ -83,6 +83,7 @@ RSpec.configure do |config|
end
end
config
.
before
(
:suite
)
do
config
.
before
(
:suite
)
do
Timecop
.
safe_mode
=
true
TestEnv
.
init
TestEnv
.
init
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