lib/testlab.rb in testlab-1.13.0 vs lib/testlab.rb in testlab-1.14.0
- old
+ new
@@ -157,10 +157,18 @@
#
# Change to the defined repository directory and load the *Labfile*.
#
# @return [Boolean] True if successful.
def boot
+
+ # Raise how many files we can have open to the hard limit.
+ rlimit_nofile = Process.getrlimit(Process::RLIMIT_NOFILE)
+ if rlimit_nofile[0] != rlimit_nofile[1]
+ self.ui.logger.info { "Changing maximum open file descriptors from #{rlimit_nofile[0].inspect} to #{rlimit_nofile[1].inspect}" }
+ Process.setrlimit(Process::RLIMIT_NOFILE, rlimit_nofile[1])
+ end
+
@labfile = TestLab::Labfile.load(labfile_path)
@labfile.testlab = self
Dir.chdir(@repo_dir)
end
@@ -347,9 +355,29 @@
def recycle
self.demolish
self.build
true
+ end
+
+ # Test Lab Doctor
+ #
+ # Attempts to analyze the lab for issues.
+ #
+ # @return [Boolean] True if everything is OK; false otherwise.
+ def doctor
+ results = Array.new
+
+ if ((rlimit_nofile = Process.getrlimit(Process::RLIMIT_NOFILE)[0]) < 1024)
+ @ui.stderr.puts(format_message("The maximum number of file handles is set to #{rlimit_nofile}! Please raise it to 1024 or higher!".red.bold))
+ results << false
+ end
+
+ results << nodes.all? do |node|
+ node.doctor
+ end
+
+ results.flatten.compact.all?
end
# Node Method Proxy
#
# Iterates all of the lab nodes, sending the supplied method name and arguments