add runaway cpu and mem tasks for testing

fix github link
This commit is contained in:
Sam 2013-11-26 13:03:58 +11:00
parent dc1b033750
commit b2680b13a5
3 changed files with 26 additions and 0 deletions

View File

@ -18,5 +18,27 @@ module DockerManager
def ps
render text: `ps aux --sort -rss`
end
def runaway_cpu
Thread.new do
a = 1
while true
a += 1
end
end
render text: "Killing CPU on #{Process.pid}"
end
def runaway_mem
Thread.new do
a = []
while true
a << Array.new(50_000_000/8)
sleep 30
end
end
render text: "Leaking memory on #{Process.pid}"
end
end
end

View File

@ -2,4 +2,6 @@ DockerManager::Engine.routes.draw do
get "admin/docker" => "admin#index"
get "admin/docker/ps" => "admin#ps"
post "admin/docker/upgrade" => "admin#upgrade"
get "admin/docker/runaway_cpu" => "admin#runaway_cpu"
get "admin/docker/runaway_mem" => "admin#runaway_mem"
end

View File

@ -37,6 +37,8 @@ class DockerManager::GitRepo
# hack so it works with git urls
url = "https://github.com/#{url.split(":")[1]}"
end
url
end
protected