deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 2/2] Server tests - fixes openstack driver instances test - broken build
Date Tue, 11 Dec 2012 08:35:12 GMT
From: marios <marios@redhat.com>

https://travis-ci.org/mifo/deltacloud/jobs/3591100

Signed-off-by: marios <marios@redhat.com>
---
 server/tests/drivers/openstack/instances_test.rb | 34 +++++++++++++-----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/server/tests/drivers/openstack/instances_test.rb b/server/tests/drivers/openstack/instances_test.rb
index e391a2a..8ce2704 100644
--- a/server/tests/drivers/openstack/instances_test.rb
+++ b/server/tests/drivers/openstack/instances_test.rb
@@ -5,6 +5,14 @@ require_relative 'common.rb'
 
 describe 'OpenStackDriver Instances' do
 
+  def credentials
+  {
+    :user => "foo@fakedomain.eu+foo@fakedomain.eu-default-tenant",
+    :password => "1234fake56789",
+    :provider => "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/"
+  }
+  end
+
   before do
     @driver = Deltacloud::new(:openstack, credentials)
     VCR.insert_cassette __name__
@@ -14,9 +22,9 @@ describe 'OpenStackDriver Instances' do
     VCR.eject_cassette
   end
 
-  it 'must throw error when wrong credentials' do
+  it 'must throw error when GET instances with wrong credentials' do
     Proc.new do
-      @driver.backend.images(OpenStruct.new(:user => 'unknown+wrong', :password =>
'wrong'))
+      @driver.backend.instances(OpenStruct.new(:user => 'unknown+wrong', :password =>
'wrong'))
     end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
   end
 
@@ -25,28 +33,23 @@ describe 'OpenStackDriver Instances' do
     @driver.instances.first.must_be_kind_of Instance
   end
 
-# FIXME: The tests above will fail because of incompatibility
-#        in a way how OpenStack handle uuid/id.
-#        Please uncomment these tests if that will be fixed.
-
-=begin
   it 'must allow to filter instances' do
-    instances = @driver.instances :id => 'fef00348-9991-404c-b0d4-655d18f84345'
+    instances = @driver.instances :id => '802775'
     instances.wont_be_empty
     instances.must_be_kind_of Array
     instances.size.must_equal 1
     puts instances.inspect
-    instances.first.id.must_equal 'fef00348-9991-404c-b0d4-655d18f84345'
+    instances.first.id.must_equal '802775'
     @driver.instances(:id => 'unknown').must_be_empty
   end
 
   it 'must allow to retrieve single instance' do
-    instance = @driver.instance :id => 'fef00348-9991-404c-b0d4-655d18f84345'
+    instance = @driver.instance :id => '802775'
     instance.wont_be_nil
-    instance.id.must_equal 'fef00348-9991-404c-b0d4-655d18f84345'
-    instance.name.must_equal 'test-3'
+    instance.id.must_equal '802775'
+    instance.name.must_equal 'server2012-12-10 17:02:57 +0200'
     instance.state.wont_be_empty
-    instance.owner_id.must_equal 'admin'
+    instance.owner_id.must_equal 'foo@fakedomain.eu'
     instance.realm_id.wont_be_empty
     instance.image_id.wont_be_empty
     instance.instance_profile.wont_be_nil
@@ -54,13 +57,12 @@ describe 'OpenStackDriver Instances' do
   end
 
   it 'must allow to create and destroy an instance' do
-    instance = @driver.create_instance 'bf7ce59a-d9f9-45d4-9313-f45b16436602', :hwp_id =>
'1'
+    instance = @driver.create_instance '47940', :hwp_id => '100'
     instance.wont_be_nil
-    instance.image_id.must_equal 'bf7ce59a-d9f9-45d4-9313-f45b16436602'
+    instance.image_id.must_equal '47940'
     instance.name.wont_be_empty
     instance.wait_for!(@driver, record_retries('inst_launch')) { |i| i.is_running? }
     puts @driver.destroy_instance(instance.id).inspect
   end
-=end
 
 end
-- 
1.7.11.7


Mime
View raw message