@@ -77,6 +77,19 @@ class ConfigurationTest < ActiveSupport::TestCase
7777 end
7878 end
7979
80+ test "async workers reject threads in favor of capacity aliases" do
81+ with_execution_isolation ( :fiber ) do
82+ configuration = SolidQueue ::Configuration . new (
83+ workers : [ { queues : "llm*" , execution_mode : :async , threads : 10 } ] ,
84+ dispatchers : [ ] ,
85+ skip_recurring : true
86+ )
87+
88+ assert_not configuration . valid?
89+ assert_match /Async workers do not accept `threads`/ , configuration . errors . full_messages . first
90+ end
91+ end
92+
8093 test "async worker capacity does not inflate required database pool size" do
8194 with_execution_isolation ( :fiber ) do
8295 configuration = SolidQueue ::Configuration . new (
@@ -201,6 +214,16 @@ class ConfigurationTest < ActiveSupport::TestCase
201214 assert_not configuration . valid?
202215 assert_match /requires fiber-scoped isolated execution state/ , configuration . errors . full_messages . first
203216
217+ with_execution_isolation ( :fiber ) do
218+ load_error = LoadError . new ( "cannot load such file -- async" )
219+ missing_dependency_error = SolidQueue ::ExecutionPools ::AsyncPool ::MissingDependencyError . new ( load_error )
220+ SolidQueue ::ExecutionPools ::AsyncPool . expects ( :ensure_dependency! ) . raises ( missing_dependency_error )
221+
222+ configuration = SolidQueue ::Configuration . new ( skip_recurring : true , dispatchers : [ ] , workers : [ { execution_mode : :async } ] )
223+ assert_not configuration . valid?
224+ assert_match /gem "async"/ , configuration . errors . full_messages . first
225+ end
226+
204227 # Not enough DB connections
205228 configuration = SolidQueue ::Configuration . new ( workers : [ { queues : "background" , threads : 50 , polling_interval : 10 } ] )
206229 assert_not configuration . valid?
0 commit comments