k1LoW/awspec

String comparison for have_record_set().a() passes tests that should fail

cbrax opened this issue · 2 comments

cbrax commented

When testing using have_record_set().a(), with or without .ttl(), tests pass regardless of what is supplied in a().

Here's what's generated by awspec:

describe route53_hosted_zone('production.local.') do
  it { should exist }
  its(:resource_record_set_count) { should eq 5 }
  it { should have_record_set('production.local.').ns('ns-1536.awsdns-00.co.uk.
ns-0.awsdns-00.com.
ns-1024.awsdns-00.org.
ns-512.awsdns-00.net.').ttl(172800) }
  it { should have_record_set('production.local.').soa('ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400').ttl(900) }
  it { should have_record_set('admin-server.ec2.production.local.').a('10.0.0.48').ttl(300) }
  it { should have_record_set('external-alb.production.local.').alias('nginx-alb-internal-bca46d66a6bd76fe.elb.ap-southeast-2.amazonaws.com.', 'ZCT6FZBF4DROD') }
  it { should have_record_set('internal-alb.production.local.').alias('internal-web-alb-internal-1933024452.ap-southeast-2.elb.amazonaws.com.', 'Z1GM3OXH4ZPM65') }
end

I want to test that the admin-server.ec2.production.local record has a value of 10.0.0.5 (so the test should fail as the actual value is '10.0.0.48'). Excerpt from my test file:

describe route53_hosted_zone('production.local.'), region: 'ap-southeast-2' do
  it { should exist }
  it { should have_record_set('admin-server.ec2.production.local.').a('10.0.0.5').ttl(300) }
end

And here's what happens when I run rspec:

c@lpt:~/git/ci-test$ rspec --format d

route53_hosted_zone 'production.local.'
  should exist
  should have record set "admin-server.ec2.production.local."

Finished in 2.79 seconds (files took 12.34 seconds to load)
2 examples, 0 failures

Unless I'm misusing have_record_set, this test should fail as the value passed in a() doesn't match the actual record. Let me know if you need any further info.

Hi @cbrax

Your report may be resolved with version 1.18.1.
Please confirm.

Regards.

Yohei

cbrax commented

Hi @inokappa

I have updated to 1.18.1 and can confirm that this now works. 👍

Thank you!

Cheers,
Chris