Skip to content

Commit 783ea8e

Browse files
committed
Test that we are only using 1 worker for GoodJob user creation.
1 parent b280844 commit 783ea8e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config/initializers/good_job.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ def authenticate_admin
1616

1717
Rails.application.configure do
1818
# The create_students_job queue is a serial queue that allows only one job at a time.
19+
# DO NOT change the the value of create_students_job:1 without understanding the implications
20+
# of processing more than one user creation job at once.:
1921
config.good_job.queues = 'create_students_job:1;default:5'
2022
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe Rails do
6+
it 'ensures the create_students_job queue only has one worker' do
7+
queues_config = described_class.application.config.good_job.queues
8+
# queues_config is a string like "create_students_job:1;default:5"
9+
10+
# Parse the queues into a hash
11+
parsed_queues = queues_config.split(';').to_h do |q|
12+
name, concurrency = q.split(':')
13+
[name, concurrency.to_i]
14+
end
15+
16+
expect(parsed_queues['create_students_job']).to eq(1)
17+
end
18+
end

0 commit comments

Comments
 (0)