tests/aws/requests/dns/dns_tests.rb in fog-1.18.0 vs tests/aws/requests/dns/dns_tests.rb in fog-1.19.0
- old
+ new
@@ -10,12 +10,10 @@
@r53_connection = Fog::DNS[:aws]
tests('success') do
test('get current zone count') do
- pending if Fog.mocking?
-
@org_zone_count= 0
response = @r53_connection.list_hosted_zones
if response.status == 200
@hosted_zones = response.body['HostedZones']
@org_zone_count = @hosted_zones.count
@@ -23,12 +21,10 @@
response.status == 200
end
test('create simple zone') {
- pending if Fog.mocking?
-
result = false
response = @r53_connection.create_hosted_zone(@domain_name)
if response.status == 201
@@ -53,12 +49,10 @@
result
}
test("get status of change #{@change_id}") {
- pending if Fog.mocking?
-
result = false
response = @r53_connection.get_change(@change_id)
if response.status == 200
status = response.body['Status']
if (status == 'PENDING') or (status == 'INSYNC')
@@ -68,12 +62,10 @@
result
}
test("get info on hosted zone #{@zone_id}") {
- pending if Fog.mocking?
-
result = false
response = @r53_connection.get_hosted_zone(@zone_id)
if response.status == 200
zone = response.body['HostedZone']
@@ -81,23 +73,20 @@
name = zone['Name']
caller_ref = zone['CallerReference']
ns_servers = response.body['NameServers']
# 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
(ns_servers.count > 0)
result = true
end
end
result
}
test('list zones') do
- pending if Fog.mocking?
-
result = false
response = @r53_connection.list_hosted_zones
if response.status == 200
@@ -118,12 +107,10 @@
result
end
test("add a A resource record") {
- pending if Fog.mocking?
-
# create an A resource record
host = 'www.' + @domain_name
ip_addrs = ['1.2.3.4']
resource_record = { :name => host, :type => 'A', :ttl => 3600, :resource_records => ip_addrs }
resource_record_set = resource_record.merge(:action => 'CREATE')
@@ -140,12 +127,10 @@
response.status == 200
}
test("add a CNAME resource record") {
- pending if Fog.mocking?
-
# create a CNAME resource record
host = 'mail.' + @domain_name
value = ['www.' + @domain_name]
resource_record = { :name => host, :type => 'CNAME', :ttl => 3600, :resource_records => value }
resource_record_set = resource_record.merge(:action => 'CREATE')
@@ -162,12 +147,10 @@
response.status == 200
}
test("add a MX resource record") {
- pending if Fog.mocking?
-
# create a MX resource record
host = @domain_name
value = ['7 mail.' + @domain_name]
resource_record = { :name => host, :type => 'MX', :ttl => 3600, :resource_records => value }
resource_record_set = resource_record.merge( :action => 'CREATE')
@@ -184,12 +167,10 @@
response.status == 200
}
test("add an ALIAS resource record") {
- pending if Fog.mocking?
-
# create a load balancer
@elb_connection.create_load_balancer(["us-east-1a"], "fog", [{"Protocol" => "HTTP", "LoadBalancerPort" => "80", "InstancePort" => "80"}])
elb_response = @elb_connection.describe_load_balancers("LoadBalancerNames" => "fog")
elb = elb_response.body["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first
@@ -211,11 +192,11 @@
puts "Hosted Zone ID (ELB): #{hosted_zone_id}"
puts "DNS Name (ELB): #{dns_name}"
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)
if response.status == 200
change_id = response.body['Id']
status = response.body['Status']
@new_records << resource_record
@@ -223,19 +204,15 @@
response.status == 200
}
tests("list resource records").formats(AWS::DNS::Formats::LIST_RESOURCE_RECORD_SETS) {
- pending if Fog.mocking?
-
# get resource records for zone
@r53_connection.list_resource_record_sets(@zone_id).body
}
test("delete #{@new_records.count} resource records") {
- pending if Fog.mocking?
-
result = true
change_batch = []
@new_records.each { |record|
resource_record_set = record.merge( :action => 'DELETE')
@@ -250,11 +227,9 @@
result
}
test("delete hosted zone #{@zone_id}") {
- pending if Fog.mocking?
-
# cleanup the ELB as well
@elb_connection.delete_load_balancer("fog")
response = @r53_connection.delete_hosted_zone(@zone_id)