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
baf540ed
Commit
baf540ed
authored
Oct 23, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve our Sidekiq testing best practices
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
37f94825
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+13
-8
No files found.
doc/development/testing_guide/best_practices.md
View file @
baf540ed
...
...
@@ -356,17 +356,22 @@ However, if a spec makes direct Redis calls, it should mark itself with the
`:clean_gitlab_redis_cache`
,
`:clean_gitlab_redis_shared_state`
or
`:clean_gitlab_redis_queues`
traits as appropriate.
Sidekiq jobs are typically not run in specs, but this behaviour can be altered
in each spec through the use of
`perform_enqueued_jobs`
blocks.
Any spec that causes Sidekiq jobs to be pushed to Redis should use the
`:sidekiq_inline`
trait, to ensure that they are removed once the spec completes.
#### Background jobs / Sidekiq
By default, Sidekiq jobs are enqueued into a jobs array and aren't processed.
If a test enqueues Sidekiq jobs and need them to be processed, the
`:sidekiq_inline`
trait can be used.
The
`:sidekiq_might_not_need_inline`
trait was added when
[
Sidekiq inline mode was
changed to fake mode
](
https://gitlab.com/gitlab-org/gitlab
-ce/merge_requests/31662
)
to all the
examples that needed Sidekiq to actually process jobs. Example
s with
changed to fake mode
](
https://gitlab.com/gitlab-org/gitlab
/merge_requests/15479
)
to all the
tests that needed Sidekiq to actually process jobs. Test
s with
this trait should be either fixed to not rely on Sidekiq processing jobs, or their
`:sidekiq_might_not_need_inline`
trait should be updated to
`:sidekiq_inline`
if the
processing of background jobs is needed/expected.
`:sidekiq_might_not_need_inline`
trait should be updated to
`:sidekiq_inline`
if
the processing of background jobs is needed/expected.
NOTE:
**Note:**
The usage of
`perform_enqueued_jobs`
is currently useless since our
workers aren't inheriting from
`ApplicationJob`
/
`ActiveJob::Base`
.
#### Filesystem
...
...
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