deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 2/2] Core: Fixed memory leaks on ruby 1.8.7
Date Fri, 20 Jul 2012 11:36:00 GMT
From: Michal Fojtik <mfojtik@redhat.com>

Minitest library seems to load the 'common.rb' file in collection
tests repeatly. This cause to require all DC libraries for every test,
which until a while leads to memory corruption. Note this problem
can be only observed under Ruby 1.8.7.

This patch also bumps sinatra-rabbit to 1.0.10 (minor typo fixed there
to make 1.8.7 tests run smoothly)

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/deltacloud-core.gemspec    |    2 +-
 server/tests/deltacloud/common.rb |   16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/server/deltacloud-core.gemspec b/server/deltacloud-core.gemspec
index 4b54470..9716427 100644
--- a/server/deltacloud-core.gemspec
+++ b/server/deltacloud-core.gemspec
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
   s.add_dependency('rake', '>= 0.8.7')
   s.add_dependency('haml', '>= 2.2.17')
   s.add_dependency('sinatra', '>= 0.9.4')
-  s.add_dependency('sinatra-rabbit', '>= 1.0.7')
+  s.add_dependency('sinatra-rabbit', '>= 1.0.10')
   s.add_dependency('crack')
   s.add_dependency('rack', '>= 1.0.0')
   s.add_dependency('rack-accept')
diff --git a/server/tests/deltacloud/common.rb b/server/tests/deltacloud/common.rb
index 7ba3ec3..23826ad 100644
--- a/server/tests/deltacloud/common.rb
+++ b/server/tests/deltacloud/common.rb
@@ -21,11 +21,13 @@ ENV['RACK_ENV']   = 'test'
 
 # Setup Deltacloud::API Sinatra instance
 #
-Deltacloud::configure do |server|
-  server.root_url '/api'
-  server.version '1.0.0'
-  server.klass 'Deltacloud::API'
-  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-end
+unless Deltacloud::config[:deltacloud]
+  Deltacloud::configure do |server|
+    server.root_url '/api'
+    server.version '1.0.0'
+    server.klass 'Deltacloud::API'
+    server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
+  end
 
-Deltacloud.require_frontend!
+  Deltacloud.require_frontend!
+end
-- 
1.7.10.2


Mime
View raw message