1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud_director] Remove vcr.

This commit is contained in:
Nick Osborn 2013-10-09 09:08:50 +01:00
parent 7b61bd5f5a
commit f6a45470e0
13 changed files with 351 additions and 420 deletions

2
.gitignore vendored
View file

@ -22,5 +22,3 @@ spec/credentials.yml
vendor/*
tags
tests/digitalocean/fixtures/
tests/vcloud_director/fixtures/vcloud/v1.5/schema/*.xsd
tests/vcloud_director/vcr_cassettes/

View file

@ -65,7 +65,6 @@ Gem::Specification.new do |s|
s.add_development_dependency('fission')
s.add_development_dependency('pry')
s.add_development_dependency('google-api-client', '~>0.6.2')
s.add_development_dependency('vcr', '~>2.6')
s.add_development_dependency('webmock', '~>1.14')
# s.add_development_dependency('ruby-libvirt','~>0.4.0')

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | catalog_items", ['vclouddirector', 'all']) do
pending if Fog.mocking?
tests("#There is more than one catalog").returns(true){ catalog.catalog_items.size >= 1 }
@ -39,4 +37,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#get").returns(catalog_item.id) { catalog_items.get(catalog_item.id).id }
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | catalogs", ['vclouddirector', 'all']) do
pending if Fog.mocking?
tests("#There is one or more catalog").returns(true){ organization.catalogs.size >= 1 }
@ -39,4 +37,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#get").returns(catalog.id) { catalogs.get(catalog.id).id }
end
end
end

View file

@ -1,12 +1,5 @@
require 'vcr'
require 'fog/vcloud_director/compute'
VCR.configure do |c|
c.cassette_library_dir = 'tests/vcloud_director/vcr_cassettes'
c.hook_into :webmock
c.allow_http_connections_when_no_cassette = true
end
def boolean?(item)
[TrueClass, FalseClass].include?(item.class)
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests('Compute::VcloudDirector | media', ['vclouddirector']) do
pending if Fog.mocking?
@ -45,4 +43,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests('#get').returns(media.id) { medias.get(media.id).id }
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | organizations", ['vclouddirector', 'all']) do
organizations = vcloud_director.organizations
tests("#There is at least one organization").returns(true) { organizations.size >= 1 }
@ -18,5 +16,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#get").returns(org.id) { organizations.get(org.id).id }
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests('Compute::VcloudDirector | tasks', ['vclouddirector']) do
pending if Fog.mocking?
@ -26,4 +24,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests('#get').returns(task.id) { tasks.get(task.id).id }
end
end
end

View file

@ -1,6 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VAPP_NAME = "shindo07"
NETWORK_NAME = "DevOps - Dev Network Connection"
NETWORK_MODE = "POOL"
@ -8,9 +7,6 @@ CATALOG_NAME = "Public VM Templates"
CATALOG_ITEM_NAME = "DEVWEB"
TAGS = { :company => "acme", :environment => "testing" }
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | vapp", ['vclouddirector', 'creation']) do
pending if Fog.mocking?
pending # FIXME: vCloud environment needs to be set up in advance
@ -95,4 +91,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | vapps", ['vclouddirector', 'all']) do
pending if Fog.mocking?
tests("#There is more than one vapp").returns(true){ vdc.vapps.size >= 1 }
@ -39,4 +37,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#get").returns(vapp.id) { vapps.get(vapp.id).id }
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | vdcs", ['vclouddirector', 'all']) do
pending if Fog.mocking?
tests("#There is one or more vdc").returns(true){ organization.vdcs.size >= 1 }
@ -41,5 +39,3 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#get").returns(vdc.id) { vdcs.get(vdc.id).id }
end
end
end

View file

@ -1,7 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::VcloudDirector | vms", ['vclouddirector', 'all']) do
pending if Fog.mocking?
vapp = vapps.detect {|v| v.vms.size >= 1}
@ -84,6 +82,4 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#collection").returns(Fog::Compute::VcloudDirector::Tags){ tags.class }
end
end
end

View file

@ -1,27 +0,0 @@
#!/usr/local/bin/ruby
# TO FIX: it reduces the number of requests but it make the tests to faile
require 'yaml'
PATH = ARGV.shift
vcr_cassete = YAML.load_file(PATH)
@num_request = 0
@pending_requests = {}
reduced_requests = vcr_cassete["http_interactions"].reject do |i|
@num_request += 1
if i["response"]["body"]["string"] =~ /running/ && i["response"]["headers"]["Content-Type"].to_s == 'application/vnd.vmware.vcloud.task+xml;version=1.5'
@pending_requests[@num_request]=true
@pending_requests[@num_request] && @pending_requests[@num_request-1] && @pending_requests[@num_request-2]
else
@pending_requests[@num_request]=false
end
end
cleaned = vcr_cassete["http_interactions"].size - reduced_requests.size
puts "cleaned: #{cleaned} requests"
vcr_cassete["http_interactions"] = reduced_requests
File.open(PATH, 'w') {|f| f.write(vcr_cassete.to_yaml) }