diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-07-18 23:43:49 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-07-18 23:43:49 +0300 |
commit | 5db5e50927e9c90c4a353897edb17eeda1f1f10f (patch) | |
tree | 05e39a5c1402ee2f95ea9d8f28b9db4681b2db35 /app/workers | |
parent | b1d2aed43acc21cfe48f517dd9dbf624549c3db7 (diff) | |
parent | dc14c91d065d869b77b0ec0db47b8b36c96f15be (diff) |
Merge branch 'an-sidekiq-chaos' into 'master'
Adds chaos endpoints to Sidekiq
Closes #64663
See merge request gitlab-org/gitlab-ce!30814
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 6 | ||||
-rw-r--r-- | app/workers/chaos/cpu_spin_worker.rb | 12 | ||||
-rw-r--r-- | app/workers/chaos/db_spin_worker.rb | 12 | ||||
-rw-r--r-- | app/workers/chaos/kill_worker.rb | 12 | ||||
-rw-r--r-- | app/workers/chaos/leak_mem_worker.rb | 12 | ||||
-rw-r--r-- | app/workers/chaos/sleep_worker.rb | 12 | ||||
-rw-r--r-- | app/workers/concerns/chaos_queue.rb | 9 |
7 files changed, 75 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 3d34bfc05c7..991a177018e 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -3,6 +3,12 @@ - auto_merge:auto_merge_process +- chaos:chaos_cpu_spin +- chaos:chaos_db_spin +- chaos:chaos_kill +- chaos:chaos_leak_mem +- chaos:chaos_sleep + - cronjob:admin_email - cronjob:expire_build_artifacts - cronjob:gitlab_usage_ping diff --git a/app/workers/chaos/cpu_spin_worker.rb b/app/workers/chaos/cpu_spin_worker.rb new file mode 100644 index 00000000000..43a32c3274f --- /dev/null +++ b/app/workers/chaos/cpu_spin_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chaos + class CpuSpinWorker + include ApplicationWorker + include ChaosQueue + + def perform(duration_s) + Gitlab::Chaos.cpu_spin(duration_s) + end + end +end diff --git a/app/workers/chaos/db_spin_worker.rb b/app/workers/chaos/db_spin_worker.rb new file mode 100644 index 00000000000..217ddabbcb6 --- /dev/null +++ b/app/workers/chaos/db_spin_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chaos + class DbSpinWorker + include ApplicationWorker + include ChaosQueue + + def perform(duration_s, interval_s) + Gitlab::Chaos.db_spin(duration_s, interval_s) + end + end +end diff --git a/app/workers/chaos/kill_worker.rb b/app/workers/chaos/kill_worker.rb new file mode 100644 index 00000000000..bbad53c9b86 --- /dev/null +++ b/app/workers/chaos/kill_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chaos + class KillWorker + include ApplicationWorker + include ChaosQueue + + def perform + Gitlab::Chaos.kill + end + end +end diff --git a/app/workers/chaos/leak_mem_worker.rb b/app/workers/chaos/leak_mem_worker.rb new file mode 100644 index 00000000000..0caa99e0de9 --- /dev/null +++ b/app/workers/chaos/leak_mem_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chaos + class LeakMemWorker + include ApplicationWorker + include ChaosQueue + + def perform(memory_mb, duration_s) + Gitlab::Chaos.leak_mem(memory_mb, duration_s) + end + end +end diff --git a/app/workers/chaos/sleep_worker.rb b/app/workers/chaos/sleep_worker.rb new file mode 100644 index 00000000000..7c724c4cb4e --- /dev/null +++ b/app/workers/chaos/sleep_worker.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chaos + class SleepWorker + include ApplicationWorker + include ChaosQueue + + def perform(duration_s) + Gitlab::Chaos.sleep(duration_s) + end + end +end diff --git a/app/workers/concerns/chaos_queue.rb b/app/workers/concerns/chaos_queue.rb new file mode 100644 index 00000000000..e406509d12d --- /dev/null +++ b/app/workers/concerns/chaos_queue.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true +# +module ChaosQueue + extend ActiveSupport::Concern + + included do + queue_namespace :chaos + end +end |