Skip to content

Commit

Permalink
Added integration spec for aws -> json
Browse files Browse the repository at this point in the history
  • Loading branch information
anaynayak committed Jan 29, 2017
1 parent 5903b07 commit 8276a95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/integration/aws_expected.json
@@ -0,0 +1 @@
{"nodes":[{"id":"asv-app","label":"asv-app"},{"id":"asv-bastion","label":"asv-bastion"},{"id":"*","label":"*"},{"id":"asv-db","label":"asv-db"},{"id":"asv-solr","label":"asv-solr"},{"id":"default","label":"default"}],"edges":[{"id":"asv-bastion-asv-app","source":"asv-bastion","target":"asv-app","label":"22/tcp"},{"id":"*-asv-app","source":"*","target":"asv-app","label":"80/tcp"},{"id":"*-asv-bastion","source":"*","target":"asv-bastion","label":"22/tcp"},{"id":"asv-app-asv-db","source":"asv-app","target":"asv-db","label":"5432/tcp"},{"id":"asv-bastion-asv-db","source":"asv-bastion","target":"asv-db","label":"22/tcp"},{"id":"asv-app-asv-solr","source":"asv-app","target":"asv-solr","label":"8983/tcp"},{"id":"asv-bastion-asv-solr","source":"asv-bastion","target":"asv-solr","label":"22/tcp"},{"id":"default-default","source":"default","target":"default","label":"0-65535/tcp,0-65535/udp,-1/icmp"},{"id":"*-default","source":"*","target":"default","label":"22/tcp"},{"id":"default-*","source":"default","target":"*","label":"*"}]}
20 changes: 20 additions & 0 deletions spec/integration/visualize_aws_spec.rb
Expand Up @@ -30,4 +30,24 @@
expect(File.read(expected_file)).to eq(temp_file.read)
end
end

if ENV["TEST_ACCESS_KEY"]
context 'ec2 to json file' do
let(:expected_file) { File.join(File.dirname(__FILE__), 'aws_expected.json') }
let(:temp_file) { Tempfile.new(%w(aws .json)) }
let(:opts) {
{
:filename => temp_file,
:secret_key => ENV["TEST_SECRET_KEY"],
:access_key => ENV["TEST_ACCESS_KEY"]
}
}

it 'should read from ec2 account', :integration => true do
expect(FileUtils).to receive(:copy)
VisualizeAws.new(config, opts).unleash(temp_file.path)
expect(File.read(expected_file)).to eq(temp_file.read)
end
end
end
end

0 comments on commit 8276a95

Please sign in to comment.