deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [4/50] [abbrv] git commit: Tests: Make possible to run each test separately and fixed openstack and rackspace tests
Date Tue, 22 May 2012 20:19:37 GMT
Tests: Make possible to run each test separately and fixed openstack and rackspace tests


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/1a8223fb
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/1a8223fb
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/1a8223fb

Branch: refs/heads/master
Commit: 1a8223fbbb72e76cfa75c388a026c43f93b6a0ad
Parents: f40fb78
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Fri May 18 13:31:54 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue May 22 22:17:39 2012 +0200

----------------------------------------------------------------------
 server/Rakefile                                    |    4 +-
 server/lib/deltacloud/drivers/features.rb          |    7 +++
 server/tests/drivers/google/api_test.rb            |    3 +
 server/tests/drivers/google/buckets_test.rb        |    3 +
 server/tests/drivers/google/common.rb              |   36 +--------------
 server/tests/drivers/mock/api_test.rb              |    3 +
 server/tests/drivers/mock/buckets_test.rb          |    3 +
 server/tests/drivers/mock/common.rb                |    1 +
 server/tests/drivers/mock/drivers_test.rb          |    3 +
 .../tests/drivers/mock/hardware_profiles_test.rb   |    3 +
 server/tests/drivers/mock/images_test.rb           |    3 +
 server/tests/drivers/mock/instances_test.rb        |    3 +
 server/tests/drivers/mock/keys_test.rb             |    3 +
 server/tests/drivers/mock/realms_test.rb           |    3 +
 .../tests/drivers/mock/storage_snapshots_test.rb   |    3 +
 server/tests/drivers/mock/storage_volumes_test.rb  |    3 +
 server/tests/drivers/openstack/api_test.rb         |    6 +-
 server/tests/drivers/openstack/common.rb           |   21 +++++++++
 .../drivers/openstack/hardware_profiles_test.rb    |    2 +-
 server/tests/drivers/openstack/images_test.rb      |    2 +-
 server/tests/drivers/openstack/instances_test.rb   |    6 +-
 server/tests/drivers/openstack/realms_test.rb      |    2 +-
 server/tests/drivers/openstack/setup.rb            |   20 --------
 server/tests/drivers/rackspace/api_test.rb         |    9 +++-
 server/tests/drivers/rackspace/buckets_test.rb     |    9 +++-
 server/tests/drivers/rackspace/common.rb           |   16 +++++++
 .../drivers/rackspace/hardware_profiles_test.rb    |    9 +++-
 server/tests/drivers/rackspace/images_test.rb      |    9 +++-
 server/tests/drivers/rackspace/instances_test.rb   |   15 ++++--
 server/tests/drivers/rackspace/realms_test.rb      |    9 +++-
 server/tests/drivers/rackspace/setup.rb            |   14 ------
 server/tests/drivers/rhevm/api_test.rb             |    4 +-
 server/tests/drivers/rhevm/common.rb               |   12 +++++-
 .../tests/drivers/rhevm/hardware_profiles_test.rb  |    3 +-
 server/tests/drivers/rhevm/images_test.rb          |    4 +-
 server/tests/drivers/rhevm/instances_test.rb       |    3 +-
 server/tests/drivers/rhevm/realms_test.rb          |    4 +-
 37 files changed, 154 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/Rakefile
----------------------------------------------------------------------
diff --git a/server/Rakefile b/server/Rakefile
index c9ef650..8223e5e 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -229,9 +229,7 @@ namespace :test do
   %w(mock rackspace rhevm openstack google fgcp).each do |driver|
     desc "Run #{driver} unit tests"
     Rake::TestTask.new(driver) { |t|
-      Rake::Task["mock:fixtures:reset"].invoke
-      t.test_files = ['tests/drivers/'+driver+'/common.rb'] + FileList.new("tests/drivers/#{driver}/*_test.rb")
-      t.options = "-v -v"
+      t.test_files = FileList.new("tests/drivers/#{driver}/*_test.rb")
       t.verbose = true
       t.warning = false
     }

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/lib/deltacloud/drivers/features.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/features.rb b/server/lib/deltacloud/drivers/features.rb
index c772a42..c2af8cb 100644
--- a/server/lib/deltacloud/drivers/features.rb
+++ b/server/lib/deltacloud/drivers/features.rb
@@ -72,6 +72,13 @@ module Deltacloud
         end
       end
 
+      feature :user_files, :for => :instances do
+        description "Allow to pass user files into the instance"
+        operation :create do
+          param :user_files, :string, :optional
+        end
+      end
+
       feature :user_iso, :for => :instances do
         description  "Base64 encoded gzipped ISO file will be accessible as CD-ROM drive
in instance"
         operation :create do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/google/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/google/api_test.rb b/server/tests/drivers/google/api_test.rb
index 88ff74d..3bb53ef 100644
--- a/server/tests/drivers/google/api_test.rb
+++ b/server/tests/drivers/google/api_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/google/common'
+
 module GoogleTest
 
   class ApiTest < Test::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/google/buckets_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/google/buckets_test.rb b/server/tests/drivers/google/buckets_test.rb
index dac8c87..14a953f 100644
--- a/server/tests/drivers/google/buckets_test.rb
+++ b/server/tests/drivers/google/buckets_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/google/common'
+
 module GoogleTest
 
   class BucketsTest < Test::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/google/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/google/common.rb b/server/tests/drivers/google/common.rb
index d9da302..ea008e2 100644
--- a/server/tests/drivers/google/common.rb
+++ b/server/tests/drivers/google/common.rb
@@ -3,6 +3,7 @@ ENV['API_USER']     = 'GOOGK7JXLS6UEYS6AYVO'
 ENV['API_PASSWORD'] = 'QjxUunLgszKhBGn/LISQajGR82CfwvraxA9lqnkg'
 
 load File.join(File.dirname(__FILE__), '..', '..', 'common.rb')
+
 require 'vcr'
 
 DeltacloudTestCommon::record!
@@ -37,38 +38,3 @@ module VCR
     end
   end
 end
-
-module Deltacloud
-  module Test
-    include Rack::Test::Methods
-
-    def included?(sub)
-      sub.class_eval do
-        before do
-          header 'Accept', 'application/xml'
-        end
-      end
-    end
-
-    def xml_response
-      Nokogiri::XML(last_response.body)
-    end
-
-    def auth_as_mock
-      authorize ENV['API_USERNAME'], ENV['API_PASSWORD']
-    end
-
-    def collection_url(collection)
-      [Deltacloud[:root_url], collection.to_s].join('/')
-    end
-
-    def app
-      Rack::Builder.new {
-        map '/' do
-          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
-          run Rack::Cascade.new([Deltacloud::API])
-        end
-      }
-    end
-  end
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/api_test.rb b/server/tests/drivers/mock/api_test.rb
index cafe0be..f8174b7 100644
--- a/server/tests/drivers/mock/api_test.rb
+++ b/server/tests/drivers/mock/api_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/buckets_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/buckets_test.rb b/server/tests/drivers/mock/buckets_test.rb
index 91970ff..d05a5fe 100644
--- a/server/tests/drivers/mock/buckets_test.rb
+++ b/server/tests/drivers/mock/buckets_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API buckets' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/common.rb b/server/tests/drivers/mock/common.rb
index 2610965..a55c44f 100644
--- a/server/tests/drivers/mock/common.rb
+++ b/server/tests/drivers/mock/common.rb
@@ -1,3 +1,4 @@
+ENV['API_DRIVER']   = 'mock'
 ENV['API_USERNAME'] = 'mockuser'
 ENV['API_PASSWORD'] = 'mockpassword'
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/drivers_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/drivers_test.rb b/server/tests/drivers/mock/drivers_test.rb
index 9e5bc71..537c341 100644
--- a/server/tests/drivers/mock/drivers_test.rb
+++ b/server/tests/drivers/mock/drivers_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API drivers' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/hardware_profiles_test.rb b/server/tests/drivers/mock/hardware_profiles_test.rb
index aed2a04..1af59ef 100644
--- a/server/tests/drivers/mock/hardware_profiles_test.rb
+++ b/server/tests/drivers/mock/hardware_profiles_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API Hardware Profiles' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/images_test.rb b/server/tests/drivers/mock/images_test.rb
index 909fdf1..0ab8db1 100644
--- a/server/tests/drivers/mock/images_test.rb
+++ b/server/tests/drivers/mock/images_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API Images' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/instances_test.rb b/server/tests/drivers/mock/instances_test.rb
index 878589c..d44fac5 100644
--- a/server/tests/drivers/mock/instances_test.rb
+++ b/server/tests/drivers/mock/instances_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API instances' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/keys_test.rb b/server/tests/drivers/mock/keys_test.rb
index 2738a50..51d385b 100644
--- a/server/tests/drivers/mock/keys_test.rb
+++ b/server/tests/drivers/mock/keys_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API Keys' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/realms_test.rb b/server/tests/drivers/mock/realms_test.rb
index 5496bc4..1540252 100644
--- a/server/tests/drivers/mock/realms_test.rb
+++ b/server/tests/drivers/mock/realms_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API Realms' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/storage_snapshots_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/storage_snapshots_test.rb b/server/tests/drivers/mock/storage_snapshots_test.rb
index 70ac2ba..2df56cb 100644
--- a/server/tests/drivers/mock/storage_snapshots_test.rb
+++ b/server/tests/drivers/mock/storage_snapshots_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API storage_snapshots' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/mock/storage_volumes_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/storage_volumes_test.rb b/server/tests/drivers/mock/storage_volumes_test.rb
index efceaee..7c41d38 100644
--- a/server/tests/drivers/mock/storage_volumes_test.rb
+++ b/server/tests/drivers/mock/storage_volumes_test.rb
@@ -1,3 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/mock/common'
+
 describe 'Deltacloud API storage_volumes' do
   include Deltacloud::Test
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/api_test.rb b/server/tests/drivers/openstack/api_test.rb
index b9c3fb2..e254060 100644
--- a/server/tests/drivers/openstack/api_test.rb
+++ b/server/tests/drivers/openstack/api_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/openstack/common'
 
 module OpenstackTest
 
@@ -36,10 +36,10 @@ module OpenstackTest
       collections.include?('instance_states').should == true
       collections.include?('instances').should == true
       collections.include?('images').should == true
-#      collections.include?('buckets').should == true # NOT YET IMPLEMENTED FOR V2 driver
+      collections.include?('buckets').should == true # NOT YET IMPLEMENTED FOR V2 driver
       collections.include?('realms').should == true
       collections.include?('hardware_profiles').should == true
-      collections.length.should == 6 #7
+      collections.length.should == 7
     end
 
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/common.rb b/server/tests/drivers/openstack/common.rb
index e69de29..595eed7 100644
--- a/server/tests/drivers/openstack/common.rb
+++ b/server/tests/drivers/openstack/common.rb
@@ -0,0 +1,21 @@
+ENV['API_DRIVER']   = "openstack"
+ENV['API_USER']     = 'foo@bar.com+foo@bar.com-default-tenant'
+ENV['API_PASSWORD'] = 'Not_a_real_password!1'
+ENV['API_PROVIDER'] = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
+
+load File.join(File.dirname(__FILE__), '..', '..', 'common.rb')
+require 'vcr'
+
+DeltacloudTestCommon::record!
+
+VCR.config do |c|
+  c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
+  c.stub_with :webmock
+  c.default_cassette_options = { :record => :none }
+end
+
+class WebMock::Config
+  def net_http_connect_on_start
+    true
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/hardware_profiles_test.rb b/server/tests/drivers/openstack/hardware_profiles_test.rb
index 68a4f0c..1225e01 100644
--- a/server/tests/drivers/openstack/hardware_profiles_test.rb
+++ b/server/tests/drivers/openstack/hardware_profiles_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/openstack/common'
 
 module OpenstackTest
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/images_test.rb b/server/tests/drivers/openstack/images_test.rb
index 3049364..bec7b27 100644
--- a/server/tests/drivers/openstack/images_test.rb
+++ b/server/tests/drivers/openstack/images_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/openstack/common'
 
 module OpenstackTest
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/instances_test.rb b/server/tests/drivers/openstack/instances_test.rb
index d7da173..3422b59 100644
--- a/server/tests/drivers/openstack/instances_test.rb
+++ b/server/tests/drivers/openstack/instances_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/openstack/common'
 
 module OpenstackTest
 
@@ -171,7 +171,7 @@ module OpenstackTest
         :'api[driver]' => 'openstack',
       }
       post_url "/api/instances/#{(@@instance/'instance').first[:id]}/stop", params
-      last_response.status.should == 200
+      last_response.status.should == 202
       20.times do |tick|
         get_auth_url "/api;driver=openstack/instances/#{(@@instance/'instance').first[:id]}",
{ :tick => tick}
         last_response.status.should_not == 500
@@ -195,7 +195,7 @@ module OpenstackTest
         :'api[driver]' => 'openstack',
       }
       post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/stop", params
-      last_response.status.should == 200
+      last_response.status.should == 202
       20.times do |tick|
         get_auth_url "/api;driver=openstack/instances/#{(@@instance2/'instance').first[:id]}",
{ :tick => tick}
         last_response.status.should_not == 500

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/realms_test.rb b/server/tests/drivers/openstack/realms_test.rb
index 613e5ec..82be205 100644
--- a/server/tests/drivers/openstack/realms_test.rb
+++ b/server/tests/drivers/openstack/realms_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/openstack/common'
 
 module OpenstackTest
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/openstack/setup.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/setup.rb b/server/tests/drivers/openstack/setup.rb
deleted file mode 100644
index b9e1ca0..0000000
--- a/server/tests/drivers/openstack/setup.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-ENV.delete 'API_VERBOSE'
-ENV['API_DRIVER']   = "openstack"
-ENV['API_USER']     = 'foo@bar.com+foo@bar.com-default-tenant'
-ENV['API_PASSWORD'] = 'Not_a_real_password!1'
-ENV['API_PROVIDER'] = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
-
-require 'vcr'
-DeltacloudTestCommon::record!
-
-VCR.config do |c|
-  c.cassette_library_dir = "#{File.dirname(__FILE__)}/../../../tests/drivers/openstack/fixtures/"
-  c.stub_with :webmock
-  c.default_cassette_options = { :record => :new_episodes }
-end
-
-class WebMock::Config
-  def net_http_connect_on_start
-    true
-  end
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/api_test.rb b/server/tests/drivers/rackspace/api_test.rb
index 802bfb8..33634d7 100644
--- a/server/tests/drivers/rackspace/api_test.rb
+++ b/server/tests/drivers/rackspace/api_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_entry_points

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/buckets_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/buckets_test.rb b/server/tests/drivers/rackspace/buckets_test.rb
index c4b0de0..9640937 100644
--- a/server/tests/drivers/rackspace/buckets_test.rb
+++ b/server/tests/drivers/rackspace/buckets_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 #require 'webmock/test_unit'
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     @@created_bucket_name="testbucki2rpux3wdelme"

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/common.rb b/server/tests/drivers/rackspace/common.rb
new file mode 100644
index 0000000..b8e1de5
--- /dev/null
+++ b/server/tests/drivers/rackspace/common.rb
@@ -0,0 +1,16 @@
+load File.join(File.dirname(__FILE__), '..', '..', 'common.rb')
+
+ENV['API_DRIVER']   = "rackspace"
+ENV['API_USER']     = 'mandreou'
+ENV['API_PASSWORD'] = 'a4d531ef02a37dd32cac1e8e516df9eb'
+
+require 'vcr'
+
+DeltacloudTestCommon::record!
+
+VCR.config do |c|
+  c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
+  c.stub_with :webmock
+  c.default_cassette_options = { :record => :none }
+end
+

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/hardware_profiles_test.rb b/server/tests/drivers/rackspace/hardware_profiles_test.rb
index 2cd6418..f1e6bc5 100644
--- a/server/tests/drivers/rackspace/hardware_profiles_test.rb
+++ b/server/tests/drivers/rackspace/hardware_profiles_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_hardware_profiles

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/images_test.rb b/server/tests/drivers/rackspace/images_test.rb
index 5bb2cc8..964caa1 100644
--- a/server/tests/drivers/rackspace/images_test.rb
+++ b/server/tests/drivers/rackspace/images_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_images

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/instances_test.rb b/server/tests/drivers/rackspace/instances_test.rb
index f185625..8d06280 100644
--- a/server/tests/drivers/rackspace/instances_test.rb
+++ b/server/tests/drivers/rackspace/instances_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_01_it_can_create_instance_without_hardware_profile
@@ -118,7 +123,7 @@ module RackspaceTest
         :'api[driver]' => 'rackspace',
       }
       post_url "/api/instances/#{(@@instance/'instance').first[:id]}/reboot", params
-      last_response.status.should == 200
+      last_response.status.should == 202
       20.times do |tick|
         get_auth_url "/api;driver=rackspace/instances/#{(@@instance/'instance').first[:id]}",
{ :tick => tick}
         last_response.status.should_not == 500
@@ -133,7 +138,7 @@ module RackspaceTest
         :'api[driver]' => 'rackspace',
       }
       post_url "/api/instances/#{(@@instance/'instance').first[:id]}/stop", params
-      last_response.status.should == 200
+      last_response.status.should == 202
       20.times do |tick|
         get_auth_url "/api;driver=rackspace/instances/#{(@@instance/'instance').first[:id]}",
{ :tick => tick}
         last_response.status.should_not == 500
@@ -148,7 +153,7 @@ module RackspaceTest
         :'api[driver]' => 'rackspace',
       }
       post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/stop", params, authenticate
-      last_response.status.should == 200
+      last_response.status.should == 202
       20.times do |tick|
         get_auth_url "/api;driver=rackspace/instances/#{(@@instance2/'instance').first[:id]}",
{ :tick => tick}
         last_response.status.should_not == 500

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/realms_test.rb b/server/tests/drivers/rackspace/realms_test.rb
index 9a01898..d221136 100644
--- a/server/tests/drivers/rackspace/realms_test.rb
+++ b/server/tests/drivers/rackspace/realms_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rackspace/common'
 
 module RackspaceTest
 
@@ -7,7 +7,12 @@ module RackspaceTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_realms

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rackspace/setup.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rackspace/setup.rb b/server/tests/drivers/rackspace/setup.rb
deleted file mode 100644
index 46c3919..0000000
--- a/server/tests/drivers/rackspace/setup.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-ENV['API_DRIVER']   = "rackspace"
-ENV['API_USER']     = 'mandreou'
-ENV['API_PASSWORD'] = 'a4d531ef02a37dd32cac1e8e516df9eb'
-
-require 'vcr'
-
-DeltacloudTestCommon::record!
-
-VCR.config do |c|
-  c.cassette_library_dir = "#{File.dirname(__FILE__)}/../../../tests/drivers/rackspace/fixtures/"
-  c.stub_with :webmock
-  c.default_cassette_options = { :record => :new_episodes }
-end
-

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/api_test.rb b/server/tests/drivers/rhevm/api_test.rb
index 0d8d69e..8c6e554 100644
--- a/server/tests/drivers/rhevm/api_test.rb
+++ b/server/tests/drivers/rhevm/api_test.rb
@@ -1,5 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rhevm/common'
 
 module RHEVMTest
 
@@ -8,8 +8,6 @@ module RHEVMTest
 
     def app
       Rack::Builder.new {
-        use Rack::MatrixParams
-        use Rack::DriverSelect
         map '/' do
           use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
           run Rack::Cascade.new([Deltacloud::API])

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb
index 1ab0f99..7777cd9 100644
--- a/server/tests/drivers/rhevm/common.rb
+++ b/server/tests/drivers/rhevm/common.rb
@@ -1,11 +1,21 @@
+load File.join(File.dirname(__FILE__), '..', '..', 'common.rb')
+
 ENV['API_USER']     = 'vdcadmin@rhev.lab.eng.brq.redhat.com'
 ENV['API_PASSWORD'] = '123456'
 ENV['API_PROVIDER'] = 'https://rhev30-dc.lab.eng.brq.redhat.com:8443/rhevm-api;645e425e-66fe-4ac9-8874-537bd10ef08d'
 
 require 'vcr'
 
+DeltacloudTestCommon::record!
+
 VCR.config do |c|
-  c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures/"
+  c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
   c.stub_with :webmock
   c.default_cassette_options = { :record => :none }
 end
+
+class WebMock::Config
+  def net_http_connect_on_start
+    true
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/hardware_profiles_test.rb b/server/tests/drivers/rhevm/hardware_profiles_test.rb
index f701fa9..65b997b 100644
--- a/server/tests/drivers/rhevm/hardware_profiles_test.rb
+++ b/server/tests/drivers/rhevm/hardware_profiles_test.rb
@@ -1,7 +1,6 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rhevm/common'
 
-DeltacloudTestCommon.record!
 module RHEVMTest
 
   class HardwareProfilesTest < Test::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/images_test.rb b/server/tests/drivers/rhevm/images_test.rb
index 3e9948a..61e305b 100644
--- a/server/tests/drivers/rhevm/images_test.rb
+++ b/server/tests/drivers/rhevm/images_test.rb
@@ -1,7 +1,5 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
-
-DeltacloudTestCommon.record!
+require 'tests/drivers/rhevm/common'
 
 module RHEVMTest
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/instances_test.rb b/server/tests/drivers/rhevm/instances_test.rb
index 179eb98..a16ea21 100644
--- a/server/tests/drivers/rhevm/instances_test.rb
+++ b/server/tests/drivers/rhevm/instances_test.rb
@@ -1,7 +1,6 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
+require 'tests/drivers/rhevm/common'
 
-DeltacloudTestCommon.record!
 module RHEVMTest
 
   class InstancesTest < Test::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1a8223fb/server/tests/drivers/rhevm/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/realms_test.rb b/server/tests/drivers/rhevm/realms_test.rb
index 2c90578..1fc0667 100644
--- a/server/tests/drivers/rhevm/realms_test.rb
+++ b/server/tests/drivers/rhevm/realms_test.rb
@@ -1,6 +1,6 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
-require 'tests/common'
-DeltacloudTestCommon.record!
+require 'tests/drivers/rhevm/common'
+
 module RHEVMTest
 
   class RealmsTest < Test::Unit::TestCase


Mime
View raw message