From 8c83652c2a0ad7386e27a9ea595c996d3dce018c Mon Sep 17 00:00:00 2001 From: Oisin Canty Date: Fri, 2 Jul 2021 13:00:57 +0000 Subject: Tests: Ruby hooks. --- test/ruby/hooks/config.ru | 7 +++++++ test/ruby/hooks/eval.rb | 3 +++ test/ruby/hooks/multiple.rb | 9 +++++++++ test/ruby/hooks/on_thread_boot.rb | 5 +++++ test/ruby/hooks/on_thread_shutdown.rb | 5 +++++ test/ruby/hooks/on_worker_boot.rb | 5 +++++ test/ruby/hooks/on_worker_shutdown.rb | 5 +++++ 7 files changed, 39 insertions(+) create mode 100644 test/ruby/hooks/config.ru create mode 100644 test/ruby/hooks/eval.rb create mode 100644 test/ruby/hooks/multiple.rb create mode 100644 test/ruby/hooks/on_thread_boot.rb create mode 100644 test/ruby/hooks/on_thread_shutdown.rb create mode 100644 test/ruby/hooks/on_worker_boot.rb create mode 100644 test/ruby/hooks/on_worker_shutdown.rb (limited to 'test/ruby/hooks') diff --git a/test/ruby/hooks/config.ru b/test/ruby/hooks/config.ru new file mode 100644 index 00000000..f3069558 --- /dev/null +++ b/test/ruby/hooks/config.ru @@ -0,0 +1,7 @@ +app = Proc.new do |env| + ['200', { + 'Content-Length' => '0' + }, ['']] +end + +run app diff --git a/test/ruby/hooks/eval.rb b/test/ruby/hooks/eval.rb new file mode 100644 index 00000000..ce7329c1 --- /dev/null +++ b/test/ruby/hooks/eval.rb @@ -0,0 +1,3 @@ +require 'securerandom' + +File.write("./cookie_eval.#{SecureRandom.hex}", "evaluated") diff --git a/test/ruby/hooks/multiple.rb b/test/ruby/hooks/multiple.rb new file mode 100644 index 00000000..295b46a9 --- /dev/null +++ b/test/ruby/hooks/multiple.rb @@ -0,0 +1,9 @@ +require 'securerandom' + +on_worker_boot do + File.write("./cookie_worker_boot.#{SecureRandom.hex}", "worker booted") +end + +on_thread_boot do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "thread booted") +end diff --git a/test/ruby/hooks/on_thread_boot.rb b/test/ruby/hooks/on_thread_boot.rb new file mode 100644 index 00000000..1e05e248 --- /dev/null +++ b/test/ruby/hooks/on_thread_boot.rb @@ -0,0 +1,5 @@ +require 'securerandom' + +on_thread_boot do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "booted") +end diff --git a/test/ruby/hooks/on_thread_shutdown.rb b/test/ruby/hooks/on_thread_shutdown.rb new file mode 100644 index 00000000..e65c1b42 --- /dev/null +++ b/test/ruby/hooks/on_thread_shutdown.rb @@ -0,0 +1,5 @@ +require 'securerandom' + +on_thread_shutdown do + File.write("./cookie_thread_shutdown.#{SecureRandom.hex}", "shutdown") +end diff --git a/test/ruby/hooks/on_worker_boot.rb b/test/ruby/hooks/on_worker_boot.rb new file mode 100644 index 00000000..b6529f60 --- /dev/null +++ b/test/ruby/hooks/on_worker_boot.rb @@ -0,0 +1,5 @@ +require 'securerandom' + +on_worker_boot do + File.write("./cookie_worker_boot.#{SecureRandom.hex}", "booted") +end diff --git a/test/ruby/hooks/on_worker_shutdown.rb b/test/ruby/hooks/on_worker_shutdown.rb new file mode 100644 index 00000000..9ffaad93 --- /dev/null +++ b/test/ruby/hooks/on_worker_shutdown.rb @@ -0,0 +1,5 @@ +require 'securerandom' + +on_worker_shutdown do + File.write("./cookie_worker_shutdown.#{SecureRandom.hex}", "shutdown") +end -- cgit