Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

memory limiting

  • Loading branch information...
commit 05396526314bad3f1606a77350279b2fecc137b0 1 parent 2a5a626
Michael Sofaer and Raphael Sofaer authored
Showing with 11 additions and 1 deletion.
  1. +6 −1 lib/hellspawn.rb
  2. +5 −0 test/hellspawn_test.rb
View
7 lib/hellspawn.rb
@@ -51,7 +51,7 @@ def march!(base, log_dir = nil)
end
end
def run_script
- "exec #{self[:executable]} " + flag_snippet
+ "exec #{dt_options}#{self[:executable]} " + flag_snippet
end
def flag_snippet
self[:flags].map{|k,v| k + " " + v.to_s}.join(" ")
@@ -62,6 +62,11 @@ def log_script log_dir
def run_prep
"exec 2&>1"
end
+ def dt_options
+ parts = []
+ parts << "softlimit #{self[:memory_limit_mb] * 1024} " if self[:memory_limit_mb]
+ parts.join("")
+ end
end
end
end
View
5 test/hellspawn_test.rb
@@ -51,6 +51,11 @@ def test_flags
run_script_lines = File.read("#{@base}/thin/run").split("\n")
assert { run_script_lines.include?("exec /usr/local/bin/thin -c /usr/local/app/my_app -e production") }
end
+ def test_memory_limit
+ @legion.summon @thin.merge(:memory_limit_mb => 500)
+ @legion.march!
+ assert {File.read("#{@base}/thin/run").match /softlimit 512000/ }
+ end
def test_stderr
@legion.summon @thin
@legion.march!
Please sign in to comment.
Something went wrong with that request. Please try again.