summaryrefslogtreecommitdiffhomepage
path: root/test/ruby
diff options
context:
space:
mode:
authorOisin Canty <o.canty@f5.com>2021-07-02 13:00:57 +0000
committerOisin Canty <o.canty@f5.com>2021-07-02 13:00:57 +0000
commit8c83652c2a0ad7386e27a9ea595c996d3dce018c (patch)
tree154281c0fc0216f5588f6a9c7f96a79c500737a5 /test/ruby
parent6c14d5d7b1921bd78f2d1b7458eae7d97eee0fcd (diff)
downloadunit-8c83652c2a0ad7386e27a9ea595c996d3dce018c.tar.gz
unit-8c83652c2a0ad7386e27a9ea595c996d3dce018c.tar.bz2
Tests: Ruby hooks.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/hooks/config.ru7
-rw-r--r--test/ruby/hooks/eval.rb3
-rw-r--r--test/ruby/hooks/multiple.rb9
-rw-r--r--test/ruby/hooks/on_thread_boot.rb5
-rw-r--r--test/ruby/hooks/on_thread_shutdown.rb5
-rw-r--r--test/ruby/hooks/on_worker_boot.rb5
-rw-r--r--test/ruby/hooks/on_worker_shutdown.rb5
7 files changed, 39 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..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