Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiz committed May 18, 2020
1 parent cf7e9f5 commit d5f5ffd
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/apigateway_spec.rb
Expand Up @@ -10,7 +10,7 @@
'tmtmok31nc.execute-api.us-east-1.amazonaws.com' => %w[54.0.0.3]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'e83d6nij2j',
hostname: 'e83d6nij2j.execute-api.us-east-1.amazonaws.com',
Expand Down
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/cloudfront_spec.rb
Expand Up @@ -9,7 +9,7 @@
'd22ycgwdruc4lt.cloudfront.net' => %w[54.0.0.1 54.0.0.2],
'd1k00qwg2uxphp.cloudfront.net' => %w[54.0.0.3]
)
expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'E1DABYDY46RHFK',
hostname: 'd22ycgwdruc4lt.cloudfront.net',
Expand Down
4 changes: 2 additions & 2 deletions spec/aws_public_ips/checks/ec2_spec.rb
Expand Up @@ -5,7 +5,7 @@
stub_request(:post, 'https://ec2.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/ec2.xml'))

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'i-0f22d0af796b3cf3a',
hostname: 'ec2-54-234-208-236.compute-1.amazonaws.com',
Expand All @@ -32,6 +32,6 @@
it 'should not return an entry when there are no public ips' do
stub_request(:post, 'https://ec2.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/ec2-private.xml'))
expect(subject.run).to eq([])
expect(subject.run(true)).to eq([])
end
end
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/elasticsearch_spec.rb
Expand Up @@ -13,7 +13,7 @@
'search-classic-fd5cbkkjuuiudho2lrwmsjp6rm.us-east-1.es.amazonaws.com' => %w[54.0.0.1]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: '154967844790/classic',
hostname: 'search-classic-fd5cbkkjuuiudho2lrwmsjp6rm.us-east-1.es.amazonaws.com',
Expand Down
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/elb_spec.rb
Expand Up @@ -10,7 +10,7 @@
'ipv6.classic-272004174.us-east-1.elb.amazonaws.com' => %w[2600:1f18:63e0:b401:b952:5715:d981:2776]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'Z35SXDOTRQ7X7K',
hostname: 'classic-272004174.us-east-1.elb.amazonaws.com',
Expand Down
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/elbv2_spec.rb
Expand Up @@ -10,7 +10,7 @@
'alb-vpc-228877692.us-east-1.elb.amazonaws.com' => %w[54.0.0.2 2600:1f18:63e0:b401:b952:5715:d981:2776]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'Z26RNL4JYFTOTI',
hostname: 'nlb-vpc-d243d0acc9151631.elb.us-east-1.amazonaws.com',
Expand Down
2 changes: 1 addition & 1 deletion spec/aws_public_ips/checks/lightsail_spec.rb
Expand Up @@ -10,7 +10,7 @@
'ce551c6f952085b4126e4b523a100eda-232829524.us-east-1.elb.amazonaws.com' => %w[54.88.163.90 52.205.146.152]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'Amazon_Linux-512MB-Virginia-1',
hostname: nil,
Expand Down
6 changes: 3 additions & 3 deletions spec/aws_public_ips/checks/rds_spec.rb
Expand Up @@ -10,7 +10,7 @@
'rds-vpc-public-us-east-1a.cyvjlokb0o75.us-east-1.rds.amazonaws.com' => %w[52.70.34.110]
)

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'db-BAKGGXYRB3EBKBDQZTAMDSGCXY',
hostname: 'rds-vpc-public.cyvjlokb0o75.us-east-1.rds.amazonaws.com',
Expand All @@ -28,13 +28,13 @@
stub_request(:post, 'https://rds.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/rds-vpc-private.xml'))

expect(subject.run).to eq([])
expect(subject.run(true)).to eq([])
end

it 'should handle db instances with a nil endpoint' do
stub_request(:post, 'https://rds.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/rds-empty-endpoint.xml'))

expect { subject.run }.to raise_error(StandardError, /has a nil endpoint/)
expect { subject.run(true) }.to raise_error(StandardError, /has a nil endpoint/)
end
end
8 changes: 4 additions & 4 deletions spec/aws_public_ips/checks/redshift_spec.rb
Expand Up @@ -5,7 +5,7 @@
stub_request(:post, 'https://redshift.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/redshift-classic-public.xml'))

expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'classic',
hostname: 'classic.csorkyt5dk7h.us-east-1.redshift.amazonaws.com',
Expand All @@ -21,7 +21,7 @@
stub_dns(
'vpc-public-2.csorkyt5dk7h.us-east-1.redshift.amazonaws.com' => %w[54.156.7.130]
)
expect(subject.run).to eq([
expect(subject.run(true)).to eq([
{
id: 'vpc-public-2',
hostname: 'vpc-public-2.csorkyt5dk7h.us-east-1.redshift.amazonaws.com',
Expand All @@ -34,12 +34,12 @@
stub_request(:post, 'https://redshift.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/redshift-vpc-private.xml'))

expect(subject.run).to eq([])
expect(subject.run(true)).to eq([])
end

it 'should handle clusters with a nil endpoint' do
stub_request(:post, 'https://redshift.us-east-1.amazonaws.com')
.to_return(body: ::IO.read('spec/fixtures/redshift-empty-endpoint.xml'))
expect { subject.run }.to raise_error(StandardError, /has a nil endpoint/)
expect { subject.run (true)}.to raise_error(StandardError, /has a nil endpoint/)
end
end

0 comments on commit d5f5ffd

Please sign in to comment.