summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2018-11-01 12:56:32 +0000
committerAndrew Newdigate <andrew@gitlab.com>2018-11-01 12:56:32 +0000
commitcfe3cfb370ca112c5cab2af3550cf68c2ec6042d (patch)
treefe6d8aed7bd3c672aee81f3a02b5eb5bd4eeecae
parente62168fcae0089d84ff00c799f98915de5ec1145 (diff)
downloadgitlab-ce-cfe3cfb370ca112c5cab2af3550cf68c2ec6042d.tar.gz
Adding chaos to GitLab through chaos endpoints
-rw-r--r--app/controllers/chaos_controller.rb9
-rw-r--r--config/routes.rb2
2 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/chaos_controller.rb b/app/controllers/chaos_controller.rb
new file mode 100644
index 00000000000..ff0ec75f39a
--- /dev/null
+++ b/app/controllers/chaos_controller.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class ChaosController < ActionController::Base
+ def sleep
+ duration_s = params[:duration_s] ? params[:duration_s].to_i : 30
+ Kernel.sleep duration_s
+ render text: "OK", content_type: 'text/plain'
+ end
+end
diff --git a/config/routes.rb b/config/routes.rb
index 37c7f98ec98..4764b85cc30 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -82,6 +82,8 @@ Rails.application.routes.draw do
draw :operations
draw :instance_statistics
+
+ get '/chaos/sleep' => 'chaos#sleep'
end
draw :api