test/system/daemon_tests.rb in qs-0.5.0 vs test/system/daemon_tests.rb in qs-0.6.0
- old
+ new
@@ -142,31 +142,10 @@
assert_equal exp, Qs.redis.with{ |c| c.get('qs-app:last_event_error') }
end
end
- class NoWorkersAvailableTests < SystemTests
- desc "when no workers are available"
- setup do
- AppDaemon.workers 0 # no workers available, don't do this
- setup_app_and_dispatcher_daemon
- end
-
- should "shutdown when stopped" do
- @app_daemon.stop
- @app_thread.join 2 # give it time to shutdown, should be faster
- assert_false @app_thread.alive?
- end
-
- should "shutdown when halted" do
- @app_daemon.halt
- @app_thread.join 2 # give it time to shutdown, should be faster
- assert_false @app_thread.alive?
- end
-
- end
-
class ShutdownWithoutTimeoutTests < SystemTests
desc "without a shutdown timeout"
setup do
AppDaemon.shutdown_timeout nil # disable shutdown timeout
setup_app_and_dispatcher_daemon
@@ -264,9 +243,27 @@
@app_thread.join 2 # give it time to shutdown, should be faster
assert_false @app_thread.alive?
encoded_payloads = Qs.redis.with{ |c| c.lrange(AppQueue.redis_key, 0, 3) }
names = encoded_payloads.map{ |sp| Qs::Payload.deserialize(sp).name }
assert_equal ['basic', 'slow', 'slow'], names
+ end
+
+ end
+
+ class WithEnvProcessLabelTests < SystemTests
+ desc "with a process label env var"
+ setup do
+ ENV['QS_PROCESS_LABEL'] = Factory.string
+
+ @daemon = AppDaemon.new
+ end
+ teardown do
+ ENV.delete('QS_PROCESS_LABEL')
+ end
+ subject{ @daemon }
+
+ should "set the daemons process label to the env var" do
+ assert_equal ENV['QS_PROCESS_LABEL'], subject.process_label
end
end
class DaemonRunner