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
a9b32f61
Commit
a9b32f61
authored
Apr 07, 2021
by
Alex Buijs
Committed by
Nick Thomas
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-add application context wrapping
parent
ae271da6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
25 deletions
+10
-25
ee/spec/workers/update_all_mirrors_worker_spec.rb
ee/spec/workers/update_all_mirrors_worker_spec.rb
+1
-1
spec/lib/gitlab/profiler_spec.rb
spec/lib/gitlab/profiler_spec.rb
+2
-7
spec/services/ci/pipeline_trigger_service_spec.rb
spec/services/ci/pipeline_trigger_service_spec.rb
+1
-1
spec/spec_helper.rb
spec/spec_helper.rb
+4
-14
spec/support/shared_examples/lib/api/ci/runner_shared_examples.rb
...port/shared_examples/lib/api/ci/runner_shared_examples.rb
+1
-1
spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb
...quests/api/logging_application_context_shared_examples.rb
+1
-1
No files found.
ee/spec/workers/update_all_mirrors_worker_spec.rb
View file @
a9b32f61
...
...
@@ -27,7 +27,7 @@ RSpec.describe UpdateAllMirrorsWorker do
worker
.
perform
end
it
'removes metadata except correlation_id from the application context before scheduling mirrors'
,
:context_aware
do
it
'removes metadata except correlation_id from the application context before scheduling mirrors'
do
inner_context
=
nil
outer_context
=
nil
...
...
spec/lib/gitlab/profiler_spec.rb
View file @
a9b32f61
...
...
@@ -78,13 +78,8 @@ RSpec.describe Gitlab::Profiler do
end
it
'strips out the private token'
do
expect
(
custom_logger
).
to
receive
(
:add
)
do
|
severity
,
_progname
,
message
|
next
if
message
.
include?
(
'spec/'
)
expect
(
severity
).
to
eq
(
Logger
::
DEBUG
)
expect
(
message
).
to
include
(
'public'
).
and
include
(
described_class
::
FILTERED_STRING
)
expect
(
message
).
not_to
include
(
private_token
)
end
.
at_least
(
1
)
# This spec could be wrapped in more blocks in the future
allow
(
custom_logger
).
to
receive
(
:add
).
and_call_original
expect
(
custom_logger
).
to
receive
(
:add
).
with
(
Logger
::
DEBUG
,
anything
,
'public [FILTERED]'
).
at_least
(
1
)
custom_logger
.
debug
(
"public
#{
private_token
}
"
)
end
...
...
spec/services/ci/pipeline_trigger_service_spec.rb
View file @
a9b32f61
...
...
@@ -11,7 +11,7 @@ RSpec.describe Ci::PipelineTriggerService do
stub_ci_pipeline_to_return_yaml_file
end
describe
'#execute'
,
:context_aware
do
describe
'#execute'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:result
)
{
described_class
.
new
(
project
,
user
,
params
).
execute
}
...
...
spec/spec_helper.rb
View file @
a9b32f61
...
...
@@ -338,21 +338,11 @@ RSpec.configure do |config|
RequestStore
.
clear!
end
if
ENV
[
'SKIP_RSPEC_CONTEXT_WRAPPING'
]
config
.
around
(
:example
,
:context_aware
)
do
|
example
|
config
.
around
do
|
example
|
# Wrap each example in it's own context to make sure the contexts don't
# leak
Gitlab
::
ApplicationContext
.
with_raw_context
{
example
.
run
}
end
else
config
.
around
do
|
example
|
if
[
:controller
,
:request
,
:feature
].
include?
(
example
.
metadata
[
:type
])
||
example
.
metadata
[
:context_aware
]
Gitlab
::
ApplicationContext
.
with_raw_context
{
example
.
run
}
else
example
.
run
end
end
end
config
.
around
do
|
example
|
with_sidekiq_server_middleware
do
|
chain
|
...
...
spec/support/shared_examples/lib/api/ci/runner_shared_examples.rb
View file @
a9b32f61
# frozen_string_literal: true
RSpec
.
shared_examples
'API::CI::Runner application context metadata'
do
|
api_route
|
it
'contains correct context metadata'
,
:context_aware
do
it
'contains correct context metadata'
do
# Avoids popping the context from the thread so we can
# check its content after the request.
allow
(
Labkit
::
Context
).
to
receive
(
:pop
)
...
...
spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb
View file @
a9b32f61
# frozen_string_literal: true
RSpec
.
shared_examples
'storing arguments in the application context'
do
it
'places the expected params in the application context'
,
:context_aware
do
it
'places the expected params in the application context'
do
# Stub the clearing of the context so we can validate it later
allow
(
Labkit
::
Context
).
to
receive
(
:pop
)
...
...
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