diff options
author | Andrei Belov <defan@nginx.com> | 2021-08-19 18:17:12 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2021-08-19 18:17:12 +0300 |
commit | db442f1be7e713e6a219621ff97a51046590dbd6 (patch) | |
tree | 913734275bc890ec175e51fcb0f36b01a3c52c24 /test/ruby/hooks | |
parent | a1d2ced6fc2317d36bc917c5d0ac339bc647dc34 (diff) | |
parent | 13c0025dfa6e041563d0ad5dd81679b44522694c (diff) | |
download | unit-db442f1be7e713e6a219621ff97a51046590dbd6.tar.gz unit-db442f1be7e713e6a219621ff97a51046590dbd6.tar.bz2 |
Merged with the default branch.1.25.0-1
Diffstat (limited to 'test/ruby/hooks')
-rw-r--r-- | test/ruby/hooks/config.ru | 7 | ||||
-rw-r--r-- | test/ruby/hooks/eval.rb | 3 | ||||
-rw-r--r-- | test/ruby/hooks/multiple.rb | 13 | ||||
-rw-r--r-- | test/ruby/hooks/on_thread_boot.rb | 9 | ||||
-rw-r--r-- | test/ruby/hooks/on_thread_shutdown.rb | 9 | ||||
-rw-r--r-- | test/ruby/hooks/on_worker_boot.rb | 5 | ||||
-rw-r--r-- | test/ruby/hooks/on_worker_shutdown.rb | 5 |
7 files changed, 51 insertions, 0 deletions
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..b1b659a5 --- /dev/null +++ b/test/ruby/hooks/multiple.rb @@ -0,0 +1,13 @@ +require 'securerandom' + +@mutex = Mutex.new + +on_worker_boot do + File.write("./cookie_worker_boot.#{SecureRandom.hex}", "worker booted") +end + +on_thread_boot do + @mutex.synchronize do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "thread booted") + end +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..4f88424e --- /dev/null +++ b/test/ruby/hooks/on_thread_boot.rb @@ -0,0 +1,9 @@ +require 'securerandom' + +@mutex = Mutex.new + +on_thread_boot do + @mutex.synchronize do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "booted") + end +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..d953b8b7 --- /dev/null +++ b/test/ruby/hooks/on_thread_shutdown.rb @@ -0,0 +1,9 @@ +require 'securerandom' + +@mutex = Mutex.new + +on_thread_shutdown do + @mutex.synchronize do + File.write("./cookie_thread_shutdown.#{SecureRandom.hex}", "shutdown") + end +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 |