mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge remote-tracking branch 'upstream/master'
Conflicts: lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb
This commit is contained in:
commit
f3527c60bb
20 changed files with 199 additions and 63 deletions
|
@ -270,7 +270,7 @@ module Fog
|
||||||
"zone-#{Fog::Mock.random_hex(8)}"
|
"zone-#{Fog::Mock.random_hex(8)}"
|
||||||
end
|
end
|
||||||
def self.change_id
|
def self.change_id
|
||||||
"change-#{Fog::Mock.random_hex(8)}"
|
Fog::Mock.random_letters_and_numbers(14)
|
||||||
end
|
end
|
||||||
def self.nameservers
|
def self.nameservers
|
||||||
[
|
[
|
||||||
|
|
|
@ -34,7 +34,8 @@ module Fog
|
||||||
:limits => {
|
:limits => {
|
||||||
:duplicate_domains => 5
|
:duplicate_domains => 5
|
||||||
},
|
},
|
||||||
:zones => {}
|
:zones => {},
|
||||||
|
:changes => {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
||||||
attribute :ramdisk_id, :aliases => 'RamdiskId'
|
attribute :ramdisk_id, :aliases => 'RamdiskId'
|
||||||
attribute :security_groups, :aliases => 'SecurityGroups'
|
attribute :security_groups, :aliases => 'SecurityGroups'
|
||||||
attribute :user_data, :aliases => 'UserData'
|
attribute :user_data, :aliases => 'UserData'
|
||||||
|
attribute :spot_price, :aliases => 'SpotPrice'
|
||||||
|
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
#attributes[:availability_zones] ||= %w(us-east-1a us-east-1b us-east-1c us-east-1d)
|
#attributes[:availability_zones] ||= %w(us-east-1a us-east-1b us-east-1c us-east-1d)
|
||||||
|
|
|
@ -70,7 +70,8 @@ module Fog
|
||||||
@launch_configuration[name] = value
|
@launch_configuration[name] = value
|
||||||
when 'IamInstanceProfile'
|
when 'IamInstanceProfile'
|
||||||
@launch_configuration[name] = value
|
@launch_configuration[name] = value
|
||||||
|
when 'SpotPrice'
|
||||||
|
@launch_configuration[name] = value.to_f
|
||||||
when 'BlockDeviceMappings'
|
when 'BlockDeviceMappings'
|
||||||
@in_block_device_mappings = false
|
@in_block_device_mappings = false
|
||||||
when 'LaunchConfigurations'
|
when 'LaunchConfigurations'
|
||||||
|
|
|
@ -141,6 +141,7 @@ module Fog
|
||||||
if (zone = self.data[:zones][zone_id])
|
if (zone = self.data[:zones][zone_id])
|
||||||
response.status = 200
|
response.status = 200
|
||||||
|
|
||||||
|
change_id = Fog::AWS::Mock.change_id
|
||||||
change_batch.each do |change|
|
change_batch.each do |change|
|
||||||
case change[:action]
|
case change[:action]
|
||||||
when "CREATE"
|
when "CREATE"
|
||||||
|
@ -149,12 +150,23 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
if zone[:records][change[:type]][change[:name]].nil?
|
if zone[:records][change[:type]][change[:name]].nil?
|
||||||
|
# raise change.to_s if change[:resource_records].nil?
|
||||||
|
zone[:records][change[:type]][change[:name]] =
|
||||||
|
if change[:alias_target]
|
||||||
|
record = {
|
||||||
|
:alias_target => change[:alias_target]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
record = {
|
||||||
|
:ttl => change[:ttl].to_s,
|
||||||
|
}
|
||||||
|
end
|
||||||
zone[:records][change[:type]][change[:name]] = {
|
zone[:records][change[:type]][change[:name]] = {
|
||||||
|
:change_id => change_id,
|
||||||
|
:resource_records => change[:resource_records] || [],
|
||||||
:name => change[:name],
|
:name => change[:name],
|
||||||
:type => change[:type],
|
:type => change[:type]
|
||||||
:ttl => change[:ttl],
|
}.merge(record)
|
||||||
:resource_records => change[:resource_records]
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
errors << "Tried to create resource record set #{change[:name]}. type #{change[:type]}, but it already exists"
|
errors << "Tried to create resource record set #{change[:name]}. type #{change[:type]}, but it already exists"
|
||||||
end
|
end
|
||||||
|
@ -166,12 +178,16 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
if errors.empty?
|
if errors.empty?
|
||||||
|
change = {
|
||||||
|
:id => change_id,
|
||||||
|
:status => 'INSYNC',
|
||||||
|
:submitted_at => Time.now.utc.iso8601
|
||||||
|
}
|
||||||
|
self.data[:changes][change[:id]] = change
|
||||||
response.body = {
|
response.body = {
|
||||||
'ChangeInfo' => {
|
'Id' => change[:id],
|
||||||
'Id' => "/change/#{Fog::AWS::Mock.change_id}",
|
'Status' => change[:status],
|
||||||
'Status' => 'INSYNC',
|
'SubmittedAt' => change[:submitted_at]
|
||||||
'SubmittedAt' => Time.now.utc.iso8601
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
else
|
else
|
||||||
|
@ -184,6 +200,7 @@ module Fog
|
||||||
response.body = "<?xml version=\"1.0\"?><Response><Errors><Error><Code>NoSuchHostedZone</Code><Message>A hosted zone with the specified hosted zone ID does not exist.</Message></Error></Errors><RequestID>#{Fog::AWS::Mock.request_id}</RequestID></Response>"
|
response.body = "<?xml version=\"1.0\"?><Response><Errors><Error><Code>NoSuchHostedZone</Code><Message>A hosted zone with the specified hosted zone ID does not exist.</Message></Error></Errors><RequestID>#{Fog::AWS::Mock.request_id}</RequestID></Response>"
|
||||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ module Fog
|
||||||
require 'time'
|
require 'time'
|
||||||
|
|
||||||
def create_hosted_zone(name, options = {})
|
def create_hosted_zone(name, options = {})
|
||||||
|
# Append a trailing period to the name if absent.
|
||||||
|
name = name + "." unless name.end_with?(".")
|
||||||
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if list_hosted_zones.body['HostedZones'].find_all {|z| z['Name'] == name}.size < self.data[:limits][:duplicate_domains]
|
if list_hosted_zones.body['HostedZones'].find_all {|z| z['Name'] == name}.size < self.data[:limits][:duplicate_domains]
|
||||||
response.status = 201
|
response.status = 201
|
||||||
|
@ -77,6 +80,12 @@ module Fog
|
||||||
:comment => options[:comment],
|
:comment => options[:comment],
|
||||||
:records => {}
|
:records => {}
|
||||||
}
|
}
|
||||||
|
change = {
|
||||||
|
:id => Fog::AWS::Mock.change_id,
|
||||||
|
:status => 'INSYNC',
|
||||||
|
:submitted_at => Time.now.utc.iso8601
|
||||||
|
}
|
||||||
|
self.data[:changes][change[:id]] = change
|
||||||
response.body = {
|
response.body = {
|
||||||
'HostedZone' => {
|
'HostedZone' => {
|
||||||
'Id' => zone_id,
|
'Id' => zone_id,
|
||||||
|
@ -85,9 +94,9 @@ module Fog
|
||||||
'Comment' => options[:comment]
|
'Comment' => options[:comment]
|
||||||
},
|
},
|
||||||
'ChangeInfo' => {
|
'ChangeInfo' => {
|
||||||
'Id' => "/change/#{Fog::AWS::Mock.change_id}",
|
'Id' => change[:id],
|
||||||
'Status' => 'INSYNC',
|
'Status' => change[:status],
|
||||||
'SubmittedAt' => Time.now.utc.iso8601
|
'SubmittedAt' => change[:submitted_at]
|
||||||
},
|
},
|
||||||
'NameServers' => Fog::AWS::Mock.nameservers
|
'NameServers' => Fog::AWS::Mock.nameservers
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,39 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
|
||||||
|
require 'time'
|
||||||
|
|
||||||
|
def delete_hosted_zone(zone_id)
|
||||||
|
response = Excon::Response.new
|
||||||
|
key = [zone_id, "/hostedzone/#{zone_id}"].find{|k| !self.data[:zones][k].nil?}
|
||||||
|
if key
|
||||||
|
change = {
|
||||||
|
:id => Fog::AWS::Mock.change_id,
|
||||||
|
:status => 'INSYNC',
|
||||||
|
:submitted_at => Time.now.utc.iso8601
|
||||||
|
}
|
||||||
|
self.data[:changes][change[:id]] = change
|
||||||
|
response.status = 200
|
||||||
|
response.body = {
|
||||||
|
'ChangeInfo' => {
|
||||||
|
'Id' => change[:id],
|
||||||
|
'Status' => change[:status],
|
||||||
|
'SubmittedAt' => change[:submitted_at]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.data[:zones].delete(key)
|
||||||
|
response
|
||||||
|
else
|
||||||
|
response.status = 404
|
||||||
|
response.body = "<?xml version=\"1.0\"?><ErrorResponse xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\"><Error><Type>Sender</Type><Code>NoSuchHostedZone</Code><Message>The specified hosted zone does not exist.</Message></Error><RequestId>#{Fog::AWS::Mock.request_id}</RequestId></ErrorResponse>"
|
||||||
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,30 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
def get_change(change_id)
|
||||||
|
response = Excon::Response.new
|
||||||
|
# find the record with matching change_id
|
||||||
|
# records = data[:zones].values.map{|z| z[:records].values.map{|r| r.values}}.flatten
|
||||||
|
change = self.data[:changes][change_id]
|
||||||
|
|
||||||
|
if change
|
||||||
|
response.status = 200
|
||||||
|
response.body = {
|
||||||
|
'Id' => change[:id],
|
||||||
|
'Status' => 'INSYNC', # TODO do some logic here
|
||||||
|
'SubmittedAt' => change[:submitted_at]
|
||||||
|
}
|
||||||
|
response
|
||||||
|
else
|
||||||
|
response.status = 404
|
||||||
|
response.body = "<?xml version=\"1.0\"?><ErrorResponse xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\"><Error><Type>Sender</Type><Code>NoSuchChange</Code><Message>Could not find resource with ID: #{change_id}</Message></Error><RequestId>#{Fog::AWS::Mock.request_id}</RequestId></ErrorResponse>"
|
||||||
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ module Fog
|
||||||
response
|
response
|
||||||
else
|
else
|
||||||
response.status = 404
|
response.status = 404
|
||||||
response.body = "<?xml version=\"1.0\"?><Response><Errors><Error><Code>NoSuchHostedZone</Code><Message>A hosted zone with the specified hosted zone ID does not exist.</Message></Error></Errors><RequestID>#{Fog::AWS::Mock.request_id}</RequestID></Response>"
|
response.body = "<?xml version=\"1.0\"?><ErrorResponse xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\"><Error><Type>Sender</Type><Code>NoSuchHostedZone</Code><Message>The specified hosted zone does not exist.</Message></Error><RequestId>#{Fog::AWS::Mock.request_id}</RequestId></ErrorResponse>"
|
||||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,12 +53,7 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def list_hosted_zones(options = {})
|
def list_hosted_zones(options = {})
|
||||||
|
maxitems = [options[:max_items]||100,100].min
|
||||||
if options[:max_items].nil?
|
|
||||||
maxitems = 100
|
|
||||||
else
|
|
||||||
maxitems = options[:max_items]
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:marker].nil?
|
if options[:marker].nil?
|
||||||
start = 0
|
start = 0
|
||||||
|
@ -82,8 +77,8 @@ module Fog
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
'Marker' => options[:marker].to_s,
|
'Marker' => options[:marker].to_s,
|
||||||
'MaxItems' => options[:max_items].to_s,
|
'MaxItems' => maxitems,
|
||||||
'IsTruncated' => truncated.to_s
|
'IsTruncated' => truncated
|
||||||
}
|
}
|
||||||
|
|
||||||
if truncated
|
if truncated
|
||||||
|
|
|
@ -60,6 +60,74 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
|
||||||
|
def list_resource_record_sets(zone_id, options = {})
|
||||||
|
maxitems = [options[:max_items]||100,100].min
|
||||||
|
|
||||||
|
response = Excon::Response.new
|
||||||
|
|
||||||
|
zone = self.data[:zones][zone_id]
|
||||||
|
if zone.nil?
|
||||||
|
response.status = 404
|
||||||
|
response.body = "<?xml version=\"1.0\"?>\n<ErrorResponse xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\"><Error><Type>Sender</Type><Code>NoSuchHostedZone</Code><Message>No hosted zone found with ID: #{zone_id}</Message></Error><RequestId>#{Fog::AWS::Mock.request_id}</RequestId></ErrorResponse>"
|
||||||
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||||
|
end
|
||||||
|
|
||||||
|
if options[:type]
|
||||||
|
records = zone[:records][options[:type]].values
|
||||||
|
else
|
||||||
|
records = zone[:records].values.map{|r| r.values}.flatten
|
||||||
|
end
|
||||||
|
|
||||||
|
# sort for pagination
|
||||||
|
records.sort! { |a,b| a[:name].gsub(zone[:name],"") <=> b[:name].gsub(zone[:name],"") }
|
||||||
|
|
||||||
|
if options[:name]
|
||||||
|
name = options[:name].gsub(zone[:name],"")
|
||||||
|
records = records.select{|r| r[:name].gsub(zone[:name],"") >= name }
|
||||||
|
require 'pp'
|
||||||
|
end
|
||||||
|
|
||||||
|
next_record = records[maxitems]
|
||||||
|
records = records[0, maxitems]
|
||||||
|
truncated = !next_record.nil?
|
||||||
|
|
||||||
|
response.status = 200
|
||||||
|
response.body = {
|
||||||
|
'ResourceRecordSets' => records.map do |r|
|
||||||
|
if r[:alias_target]
|
||||||
|
record = {
|
||||||
|
'AliasTarget' => {
|
||||||
|
'HostedZoneId' => r[:alias_target][:hosted_zone_id],
|
||||||
|
'DNSName' => r[:alias_target][:dns_name]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
record = {
|
||||||
|
'TTL' => r[:ttl]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
{
|
||||||
|
'ResourceRecords' => r[:resource_records],
|
||||||
|
'Name' => r[:name],
|
||||||
|
'Type' => r[:type]
|
||||||
|
}.merge(record)
|
||||||
|
end,
|
||||||
|
'MaxItems' => maxitems,
|
||||||
|
'IsTruncated' => truncated
|
||||||
|
}
|
||||||
|
|
||||||
|
if truncated
|
||||||
|
response.body['NextRecordName'] = next_record[:name]
|
||||||
|
response.body['NextRecordType'] = next_record[:type]
|
||||||
|
end
|
||||||
|
|
||||||
|
response
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -174,6 +174,14 @@ module Fog
|
||||||
|
|
||||||
# NOTE: differs from Fog::AWS.escape by NOT escaping `/`
|
# NOTE: differs from Fog::AWS.escape by NOT escaping `/`
|
||||||
def escape(string)
|
def escape(string)
|
||||||
|
unless @unf_loaded_or_warned
|
||||||
|
begin
|
||||||
|
require('unf/normalizer')
|
||||||
|
rescue LoadError
|
||||||
|
Fog::Logger.warning("Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.")
|
||||||
|
end
|
||||||
|
@unf_loaded_or_warned = true
|
||||||
|
end
|
||||||
string = defined?(::UNF::Normalizer) ? ::UNF::Normalizer.normalize(string, :nfc) : string
|
string = defined?(::UNF::Normalizer) ? ::UNF::Normalizer.normalize(string, :nfc) : string
|
||||||
string.gsub(/([^a-zA-Z0-9_.\-~\/]+)/) {
|
string.gsub(/([^a-zA-Z0-9_.\-~\/]+)/) {
|
||||||
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
||||||
|
|
|
@ -74,6 +74,13 @@ module Fog
|
||||||
rand(max).to_s
|
rand(max).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.random_letters_and_numbers(length)
|
||||||
|
random_selection(
|
||||||
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
|
||||||
|
length
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def self.random_selection(characters, length)
|
def self.random_selection(characters, length)
|
||||||
selection = ''
|
selection = ''
|
||||||
length.times do
|
length.times do
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
Shindo.tests("Fog::Dns[:aws] | record", ['aws', 'dns']) do
|
Shindo.tests("Fog::Dns[:aws] | record", ['aws', 'dns']) do
|
||||||
|
|
||||||
pending if Fog.mocking?
|
|
||||||
tests("zones#create").succeeds do
|
tests("zones#create").succeeds do
|
||||||
@zone = Fog::DNS[:aws].zones.create(:domain => generate_unique_domain)
|
@zone = Fog::DNS[:aws].zones.create(:domain => generate_unique_domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
params = { :name => @zone.domain, :type => 'A', :ttl => 3600, :value => ['1.2.3.4'] }
|
params = { :name => @zone.domain, :type => 'A', :ttl => 3600, :value => ['1.2.3.4'] }
|
||||||
|
|
||||||
model_tests(@zone.records, params, false) do
|
model_tests(@zone.records, params) do
|
||||||
|
|
||||||
# Newly created records should have a change id
|
# Newly created records should have a change id
|
||||||
tests("#change_id") do
|
tests("#change_id") do
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Shindo.tests("Fog::DNS[:aws] | records", ['aws', 'dns']) do
|
Shindo.tests("Fog::DNS[:aws] | records", ['aws', 'dns']) do
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
tests("zones#create").succeeds do
|
tests("zones#create").succeeds do
|
||||||
@zone = Fog::DNS[:aws].zones.create(:domain => generate_unique_domain)
|
@zone = Fog::DNS[:aws].zones.create(:domain => generate_unique_domain)
|
||||||
|
@ -13,7 +12,7 @@ Shindo.tests("Fog::DNS[:aws] | records", ['aws', 'dns']) do
|
||||||
]
|
]
|
||||||
|
|
||||||
param_groups.each do |params|
|
param_groups.each do |params|
|
||||||
collection_tests(@zone.records, params, false)
|
collection_tests(@zone.records, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
|
@ -24,11 +23,7 @@ Shindo.tests("Fog::DNS[:aws] | records", ['aws', 'dns']) do
|
||||||
|
|
||||||
records << @zone.records.create(:name => "*.#{@zone.domain}", :type => "A", :ttl => 3600, :value => ['1.2.3.4'])
|
records << @zone.records.create(:name => "*.#{@zone.domain}", :type => "A", :ttl => 3600, :value => ['1.2.3.4'])
|
||||||
|
|
||||||
tests("#all!").returns(103) do
|
tests("#all!").returns(101) do
|
||||||
@zone.records.all!.size
|
|
||||||
end
|
|
||||||
|
|
||||||
tests("#all!").returns(103) do
|
|
||||||
@zone.records.all!.size
|
@zone.records.all!.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Shindo.tests("Fog::DNS[:aws] | zone", ['aws', 'dns']) do
|
Shindo.tests("Fog::DNS[:aws] | zone", ['aws', 'dns']) do
|
||||||
params = {:domain => generate_unique_domain }
|
params = {:domain => generate_unique_domain }
|
||||||
model_tests(Fog::DNS[:aws].zones, params, false)
|
model_tests(Fog::DNS[:aws].zones, params)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Shindo.tests("Fog::DNS[:aws] | zones", ['aws', 'dns']) do
|
Shindo.tests("Fog::DNS[:aws] | zones", ['aws', 'dns']) do
|
||||||
params = {:domain => generate_unique_domain }
|
params = {:domain => generate_unique_domain }
|
||||||
collection_tests(Fog::DNS[:aws].zones, params, false)
|
collection_tests(Fog::DNS[:aws].zones, params)
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,8 +12,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
test('get current zone count') do
|
test('get current zone count') do
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
@org_zone_count= 0
|
@org_zone_count= 0
|
||||||
response = @r53_connection.list_hosted_zones
|
response = @r53_connection.list_hosted_zones
|
||||||
if response.status == 200
|
if response.status == 200
|
||||||
|
@ -25,8 +23,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
end
|
end
|
||||||
|
|
||||||
test('create simple zone') {
|
test('create simple zone') {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
response = @r53_connection.create_hosted_zone(@domain_name)
|
response = @r53_connection.create_hosted_zone(@domain_name)
|
||||||
|
@ -55,8 +51,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("get status of change #{@change_id}") {
|
test("get status of change #{@change_id}") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
result = false
|
result = false
|
||||||
response = @r53_connection.get_change(@change_id)
|
response = @r53_connection.get_change(@change_id)
|
||||||
if response.status == 200
|
if response.status == 200
|
||||||
|
@ -70,8 +64,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("get info on hosted zone #{@zone_id}") {
|
test("get info on hosted zone #{@zone_id}") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
response = @r53_connection.get_hosted_zone(@zone_id)
|
response = @r53_connection.get_hosted_zone(@zone_id)
|
||||||
|
@ -83,7 +75,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
ns_servers = response.body['NameServers']
|
ns_servers = response.body['NameServers']
|
||||||
|
|
||||||
# AWS returns domain with a dot at end - so when compare, remove dot
|
# AWS returns domain with a dot at end - so when compare, remove dot
|
||||||
|
|
||||||
if (zone_id == @zone_id) and (name.chop == @domain_name) and (caller_ref.length > 0) and
|
if (zone_id == @zone_id) and (name.chop == @domain_name) and (caller_ref.length > 0) and
|
||||||
(ns_servers.count > 0)
|
(ns_servers.count > 0)
|
||||||
result = true
|
result = true
|
||||||
|
@ -94,8 +85,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test('list zones') do
|
test('list zones') do
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
response = @r53_connection.list_hosted_zones
|
response = @r53_connection.list_hosted_zones
|
||||||
|
@ -120,8 +109,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
end
|
end
|
||||||
|
|
||||||
test("add a A resource record") {
|
test("add a A resource record") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# create an A resource record
|
# create an A resource record
|
||||||
host = 'www.' + @domain_name
|
host = 'www.' + @domain_name
|
||||||
ip_addrs = ['1.2.3.4']
|
ip_addrs = ['1.2.3.4']
|
||||||
|
@ -142,8 +129,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("add a CNAME resource record") {
|
test("add a CNAME resource record") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# create a CNAME resource record
|
# create a CNAME resource record
|
||||||
host = 'mail.' + @domain_name
|
host = 'mail.' + @domain_name
|
||||||
value = ['www.' + @domain_name]
|
value = ['www.' + @domain_name]
|
||||||
|
@ -164,8 +149,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("add a MX resource record") {
|
test("add a MX resource record") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# create a MX resource record
|
# create a MX resource record
|
||||||
host = @domain_name
|
host = @domain_name
|
||||||
value = ['7 mail.' + @domain_name]
|
value = ['7 mail.' + @domain_name]
|
||||||
|
@ -186,8 +169,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("add an ALIAS resource record") {
|
test("add an ALIAS resource record") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# create a load balancer
|
# create a load balancer
|
||||||
@elb_connection.create_load_balancer(["us-east-1a"], "fog", [{"Protocol" => "HTTP", "LoadBalancerPort" => "80", "InstancePort" => "80"}])
|
@elb_connection.create_load_balancer(["us-east-1a"], "fog", [{"Protocol" => "HTTP", "LoadBalancerPort" => "80", "InstancePort" => "80"}])
|
||||||
|
|
||||||
|
@ -213,7 +194,7 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
puts "DNS Name (ELB): #{dns_name}"
|
puts "DNS Name (ELB): #{dns_name}"
|
||||||
puts "Zone ID for Route 53: #{@zone_id}"
|
puts "Zone ID for Route 53: #{@zone_id}"
|
||||||
|
|
||||||
sleep 120
|
sleep 120 unless Fog.mocking?
|
||||||
response = @r53_connection.change_resource_record_sets(@zone_id, change_batch, options)
|
response = @r53_connection.change_resource_record_sets(@zone_id, change_batch, options)
|
||||||
if response.status == 200
|
if response.status == 200
|
||||||
change_id = response.body['Id']
|
change_id = response.body['Id']
|
||||||
|
@ -225,15 +206,11 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
tests("list resource records").formats(AWS::DNS::Formats::LIST_RESOURCE_RECORD_SETS) {
|
tests("list resource records").formats(AWS::DNS::Formats::LIST_RESOURCE_RECORD_SETS) {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# get resource records for zone
|
# get resource records for zone
|
||||||
@r53_connection.list_resource_record_sets(@zone_id).body
|
@r53_connection.list_resource_record_sets(@zone_id).body
|
||||||
}
|
}
|
||||||
|
|
||||||
test("delete #{@new_records.count} resource records") {
|
test("delete #{@new_records.count} resource records") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
change_batch = []
|
change_batch = []
|
||||||
|
@ -252,8 +229,6 @@ Shindo.tests('Fog::DNS[:aws] | DNS requests', ['aws', 'dns']) do
|
||||||
}
|
}
|
||||||
|
|
||||||
test("delete hosted zone #{@zone_id}") {
|
test("delete hosted zone #{@zone_id}") {
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
# cleanup the ELB as well
|
# cleanup the ELB as well
|
||||||
@elb_connection.delete_load_balancer("fog")
|
@elb_connection.delete_load_balancer("fog")
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ module Shindo
|
||||||
def rackspace_test_image_id(service)
|
def rackspace_test_image_id(service)
|
||||||
image_id = Fog.credentials[:rackspace_image_id]
|
image_id = Fog.credentials[:rackspace_image_id]
|
||||||
# I chose to use the first Ubuntu because it will work with the smallest flavor and it doesn't require a license
|
# I chose to use the first Ubuntu because it will work with the smallest flavor and it doesn't require a license
|
||||||
image_id ||= Fog.mocking? ? @service.images.first.id : @service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image
|
image_id ||= Fog.mocking? ? service.images.first.id : service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image
|
||||||
end
|
end
|
||||||
|
|
||||||
def rackspace_test_flavor_id(service)
|
def rackspace_test_flavor_id(service)
|
||||||
|
|
|
@ -2,7 +2,9 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
||||||
|
|
||||||
Shindo.tests("Compute::VcloudDirector | vapps", ['vclouddirector', 'all']) do
|
Shindo.tests("Compute::VcloudDirector | vapps", ['vclouddirector', 'all']) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
tests("#There is more than one vapp").returns(true){ vdc.vapps.size >= 1 }
|
|
||||||
|
# unless there is atleast one vapp we cannot run these tests
|
||||||
|
pending if vdc.vapps.empty?
|
||||||
|
|
||||||
vapps = vdc.vapps
|
vapps = vdc.vapps
|
||||||
vapp = vapps.first
|
vapp = vapps.first
|
||||||
|
|
Loading…
Add table
Reference in a new issue