@@ -26,6 +26,13 @@ class ConfigurationTest < ActiveSupport::TestCase
2626 assert_processes configuration , :dispatcher , 1 , batch_size : SolidQueue ::Configuration ::DISPATCHER_DEFAULTS [ :batch_size ]
2727 end
2828
29+ test "warns if provided configuration file does not exist" do
30+ assert_output "[solid_queue] WARNING: Provided configuration file '/path/to/nowhere.yml' does not exist. Falling back to default configuration.\n " do
31+ configuration = SolidQueue ::Configuration . new ( config_file : Pathname . new ( "/path/to/nowhere.yml" ) )
32+ assert configuration . valid?
33+ end
34+ end
35+
2936 test "read configuration from default file" do
3037 configuration = SolidQueue ::Configuration . new
3138 assert 3 , configuration . configured_processes . count
@@ -120,16 +127,20 @@ class ConfigurationTest < ActiveSupport::TestCase
120127 assert error . include? ( "periodic_invalid_class: Class name doesn't correspond to an existing class" )
121128 assert error . include? ( "periodic_incorrect_schedule: Schedule is not a supported recurring schedule" )
122129
123- assert SolidQueue ::Configuration . new ( recurring_schedule_file : config_file_path ( :empty_recurring ) ) . valid?
130+ assert_output ( /Provided configuration file '[^']+' does not exist\. / ) do
131+ assert SolidQueue ::Configuration . new ( recurring_schedule_file : config_file_path ( :empty_recurring ) ) . valid?
132+ end
124133 assert SolidQueue ::Configuration . new ( skip_recurring : true ) . valid?
125134
126135 configuration = SolidQueue ::Configuration . new ( recurring_schedule_file : config_file_path ( :recurring_with_production_only ) )
127136 assert configuration . valid?
128137 assert_processes configuration , :scheduler , 0
129138
130- configuration = SolidQueue ::Configuration . new ( recurring_schedule_file : config_file_path ( :recurring_with_empty ) )
131- assert configuration . valid?
132- assert_processes configuration , :scheduler , 0
139+ assert_output ( /Provided configuration file '[^']+' does not exist\. / ) do
140+ configuration = SolidQueue ::Configuration . new ( recurring_schedule_file : config_file_path ( :recurring_with_empty ) )
141+ assert configuration . valid?
142+ assert_processes configuration , :scheduler , 0
143+ end
133144
134145 # No processes
135146 configuration = SolidQueue ::Configuration . new ( skip_recurring : true , dispatchers : [ ] , workers : [ ] )
0 commit comments