Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: infochimps-labs/ironfan
...
head fork: infochimps-labs/ironfan
  • 5 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 10, 2014
@kornypoet kornypoet fix spec for new resolution rules
Change-Id: Ied3c893e347829d1f2ece1e52ddb06fd9fcbb3c2
d63ee0a
@kornypoet kornypoet fix spec for new resolution rules
Change-Id: Ia0d24981c1cd4837b0196d24ed98e857ba73b54a
bbb9198
@kornypoet kornypoet fix spec for new resolution rules
Change-Id: Id66a54237468269a4c96b560adf94fdcad9a4f95
c9197a3
@kornypoet kornypoet moving gunbai to a realm scope
Change-Id: I35d82b874a26f484d7404db6ce7cc8fe17b9abd9
631be86
@kornypoet kornypoet fix spec for new resolution rules
Change-Id: Ida0cf22abf449e59c9ff27d3ba1bab9dbceec322
b69b64e
View
8 spec/chef/cluster_bootstrap_spec.rb
@@ -28,13 +28,13 @@
subject.config[:yes] = true
end
context 'full slice' do
- let(:slice){ ['gunbai'] }
+ let(:slice){ ['samurai-gunbai'] }
it 'fails if there are multiple environments' do
expect{ subject.run }.to raise_error("Cannot bootstrap multiple chef environments")
end
end
context 'partial slice' do
- let(:slice){ ['gunbai-hub'] }
+ let(:slice){ ['samurai-gunbai-hub'] }
it 'runs' do
subject.should_receive(:run_bootstrap).once
subject.run
@@ -43,8 +43,4 @@
end
- # it 'loads computers from json' do
- # computers.length.should == 2
- # computers.first.server.full_name.should == 'gunbai-hub-0'
- # end
end
View
2  spec/chef/cluster_launch_spec.rb
@@ -28,7 +28,7 @@
subject.config[:bootstrap] = true
end
context 'full slice' do
- let(:slice){ ['gunbai'] }
+ let(:slice){ ['samurai-gunbai'] }
it 'fails if there are multiple environments' do
expect{ subject.run }.to raise_error("Cannot bootstrap multiple chef environments")
end
View
24 spec/fixtures/gunbai.rb
@@ -1,24 +0,0 @@
-Ironfan.cluster 'gunbai' do
- cloud(:ec2) do
- permanent false
- availability_zones ['us-east-1d']
- flavor 't1.micro'
- backing 'ebs'
- image_name 'natty'
- bootstrap_distro 'ubuntu10.04-ironfan'
- chef_client_script 'client.rb'
- mount_ephemerals
- end
-
- environment :dev
-
- role :ssh
- cloud(:ec2).security_group(:ssh).authorize_port_range(22..22)
-
- facet :hub do
- end
-
- facet :spoke do
- environment :other
- end
-end
View
26 spec/fixtures/realms/samurai.rb
@@ -0,0 +1,26 @@
+Ironfan.realm 'samurai' do
+ cluster 'gunbai' do
+ cloud(:ec2) do
+ permanent false
+ availability_zones ['us-east-1d']
+ flavor 't1.micro'
+ backing 'ebs'
+ image_name 'natty'
+ bootstrap_distro 'ubuntu10.04-ironfan'
+ chef_client_script 'client.rb'
+ mount_ephemerals
+ end
+
+ environment :dev
+
+ role :ssh
+ cloud(:ec2).security_group(:ssh).authorize_port_range(22..22)
+
+ facet :hub do
+ end
+
+ facet :spoke do
+ environment :other
+ end
+ end
+end
View
33 spec/ironfan/ec2/cloud_provider_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
describe Ironfan::Dsl::Cluster do
- let (:cluster) do
- Ironfan.cluster "sparky" do
+ let(:cluster) do
+ Ironfan.cluster 'sparky' do
cloud(:ec2) do
- security_group(:ssh).authorize_port_range 22..22
+ security_group(:ssh).authorize_port_range(22..22)
flavor 't1.micro'
end
@@ -13,28 +13,29 @@
instances 3
cloud(:ec2) do
flavor 'm1.small'
- mount_ephemerals({ :disks => { 0 => { :mount_point => '/data' } } })
+ mount_ephemerals(disks: { 0 => { mount_point: '/data' } })
end
- end
-
+ end
end
+
+ Ironfan.cluster('sparky').resolve
end
- describe 'web facet server resolution' do
- before { @facet = cluster.facets.values.first }
- subject { @facet }
- its(:name) { should eql "web" }
+ context 'web facet server resolution' do
+ subject(:facet){ cluster.facets.values.first }
+
+ its(:name){ should eq('web') }
- it 'should have the right number of servers' do
- @facet.servers.length.should == 3
+ it 'has the right number of servers' do
+ facet.servers.length.should eq(3)
end
- it 'should have one cloud provider, EC2' do
- @facet.servers[0].clouds.keys.should == [ :ec2 ]
+ it 'has one cloud provider, EC2' do
+ facet.servers[0].clouds.keys.should eq([:ec2])
end
- it 'should have its first ephemeral disk mounted at /data' do
- @facet.servers[0].implied_volumes[1].mount_point.should == '/data'
+ it 'has its first ephemeral disk mounted at /data' do
+ facet.servers[0].implied_volumes[1].mount_point.should eq('/data')
end
end
View
81 spec/ironfan/ec2/elb_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
cert = File.read Pathname.path_to(:fixtures).join('ec2/elb/snakeoil.crt').to_s
-key = File.read Pathname.path_to(:fixtures).join('ec2/elb/snakeoil.key').to_s
+key = File.read Pathname.path_to(:fixtures).join('ec2/elb/snakeoil.key').to_s
describe Ironfan::Dsl::Cluster do
- let (:cluster) do
+ let(:cluster) do
- Ironfan.cluster "sparky" do
+ Ironfan.cluster 'sparky' do
cloud(:ec2) do
- iam_server_certificate "snake-oil" do
+ iam_server_certificate 'snake-oil' do
certificate cert
private_key key
end
@@ -19,7 +19,7 @@
instances 2
cloud(:ec2) do
- elastic_load_balancer "sparky-elb" do
+ elastic_load_balancer 'sparky-elb' do
map_port('HTTP', 80, 'HTTP', 81)
map_port('HTTPS', 443, 'HTTP', 81, 'snake-oil')
disallowed_ciphers %w[ RC4-SHA ]
@@ -38,52 +38,57 @@
end
end
end
+
+ Ironfan.cluster('sparky').resolve
end
- describe 'cluster definition' do
- subject { cluster }
+ context 'cluster definition' do
+ subject{ cluster }
- its(:name) { should eql "sparky" }
- its(:environment) { should eql :_default }
- its(:run_list) { should eql [] }
+ its(:name) { should eq('sparky') }
+ its(:environment){ should eq(:_default) }
+ its(:run_list) { should eq([]) }
- it "should have one IAM server certificate" do
- cluster.clouds.values.first.iam_server_certificates.values.length.should == 1
+ it 'has one IAM server certificate' do
+ cluster.clouds.values.first.iam_server_certificates.values.length.should eq(1)
end
- describe 'facets' do
- before { @facets = cluster.facets }
- subject { @facets.values }
- its(:length) { should eql 1 }
+ context 'facets' do
+ let(:facets){ cluster.facets }
+
+ subject{ facets.values }
+
+ its(:length){ should eq(1) }
+
+ context 'web facet' do
+ subject(:facet){ facets.values.first }
- describe 'web facet' do
- before { @facet = @facets.values.first }
- subject { @facet }
- its(:name) { should eql "web" }
- describe "elastic load balancers" do
+ its(:name){ should eq('web') }
- before { @elb = @facet.clouds.values.first.elastic_load_balancers.values.first }
- subject { @elb }
- its(:name) { should eql "sparky-elb" }
+ context 'elastic load balancer' do
- it "should have two port mappings" do
- @elb.port_mappings.length.should == 2
+ subject(:elb){ facet.clouds.values.first.elastic_load_balancers.values.first }
+
+ its(:name){ should eq('sparky-elb') }
+
+ it 'has two port mappings' do
+ elb.port_mappings.length.should eq(2)
end
- it "should have just one disallowed SSL cipher" do
- @elb.disallowed_ciphers.length.should == 1
+ it 'has just one disallowed SSL cipher' do
+ elb.disallowed_ciphers.length.should eq(1)
end
- describe "health check" do
- before { @hc = @elb.health_check }
- subject { @hc }
- its(:ping_protocol) { should eql 'HTTP' }
- its(:ping_port) { should eql 82 }
- its(:ping_path) { should eql '/healthcheck' }
- its(:timeout) { should eql 4 }
- its(:interval) { should eql 10 }
- its(:unhealthy_threshold) { should eql 3 }
- its(:healthy_threshold) { should eql 2 }
+ context 'health check' do
+ subject(:health_check){ elb.health_check }
+
+ its(:ping_protocol) { should eq('HTTP') }
+ its(:ping_port) { should eq(82) }
+ its(:ping_path) { should eq('/healthcheck') }
+ its(:timeout) { should eq(4) }
+ its(:interval) { should eq(10) }
+ its(:unhealthy_threshold){ should eq(3) }
+ its(:healthy_threshold) { should eq(2) }
end
end
View
90 spec/ironfan/ec2/security_group_spec.rb
@@ -1,98 +1,98 @@
require 'spec_helper'
describe Ironfan::Dsl::Cluster do
- let (:cluster) do
- Ironfan.cluster "sparky" do
+ let(:cluster) do
+ Ironfan.cluster 'quirky' do
cloud(:ec2) do
- security_group(:ssh).authorize_port_range 22..22
+ security_group(:ssh).authorize_port_range(22..22)
flavor 't1.micro'
end
facet :web do
- cloud(:ec2).security_group("sparky-web").authorize_port_range(80)
+ cloud(:ec2).security_group('quirky-web').authorize_port_range(80)
cloud(:ec2).flavor 'm1.small'
end
facet :mysql do
# My what a permissive database you have.
- cloud(:ec2).security_group("sparky-mysql").authorize_port_range(3306)
+ cloud(:ec2).security_group('quirky-mysql').authorize_port_range(3306)
cloud(:ec2).flavor 'm1.xlarge'
end
-
end
+
+ Ironfan.cluster('quirky').resolve
end
- describe 'cluster definition' do
- subject { cluster }
+ context 'cluster definition' do
+ subject{ cluster }
+
+ its(:name) { should eq('quirky') }
+ its(:environment){ should eq(:_default) }
+ its(:run_list) { should eq([]) }
+
+ context 'facets' do
+ let(:facets){ cluster.facets }
- its(:name) { should eql "sparky" }
- its(:environment) { should eql :_default }
- its(:run_list) { should eql [] }
+ subject{ facets.values }
- describe 'facets' do
- before { @facets = cluster.facets }
- subject { @facets.values }
- its(:length) { should eql 2 }
+ its(:length){ should eq(2) }
- describe 'web facet' do
- before { @facet = @facets.values.first }
- subject { @facet }
- its(:name) { should eql "web" }
+ context 'web facet' do
+ subject(:facet){ facets.values.first }
- it 'should have the correct flavor' do
- @facet.cloud(:ec2).flavor.should == 'm1.small'
+ its(:name){ should eq('web') }
+
+ it 'has the correct flavor' do
+ facet.cloud(:ec2).flavor.should eq('m1.small')
end
- it 'should have the right number of servers' do
- @facet.servers.length.should == 1
+ it 'has the right number of servers' do
+ facet.servers.length.should eq(1)
end
- describe 'security groups' do
- before { @groups = @facet.clouds.values.first.security_groups.values }
- subject { @groups }
+ context 'security groups' do
+ subject(:groups){ facet.clouds.values.first.security_groups.values }
- its(:length) { should eql 2 }
+ its(:length){ should eq(2) }
it 'authorizes ssh on port 22 from anywhere' do
- ssh_auth = @groups.detect { |g| g.name == 'ssh' }
+ ssh_auth = groups.detect{ |g| g.name == 'ssh' }
ssh_auth.should_not be_nil
- ssh_auth.range_authorizations.select { |g| g.eql? [22..22, "0.0.0.0/0", "tcp"] }.should_not be_empty
+ ssh_auth.range_authorizations.should include([22..22, '0.0.0.0/0', 'tcp'])
end
it 'authorizes HTTP on port 80 from anywhere' do
- http_auth = @groups.detect { |g| g.name == 'sparky-web' }
+ http_auth = groups.detect{ |g| g.name == 'quirky-web' }
http_auth.should_not be_nil
- http_auth.range_authorizations.select { |g| g.eql? [80..80, "0.0.0.0/0", "tcp"] }.should_not be_empty
+ http_auth.range_authorizations.should include([80..80, '0.0.0.0/0', 'tcp'])
end
end
end
- describe 'mysql facet' do
- before { @facet = @facets.values.last }
- subject { @facet }
- its(:name) { should eql "mysql" }
+ context 'mysql facet' do
+ subject(:facet){ facets.values.last }
+
+ its(:name){ should eq('mysql') }
- it 'should have the correct flavor' do
- @facet.cloud(:ec2).flavor.should == 'm1.xlarge'
+ it 'has the correct flavor' do
+ facet.cloud(:ec2).flavor.should eq('m1.xlarge')
end
- describe 'security groups' do
- before { @groups = @facet.clouds.values.first.security_groups.values }
- subject { @groups }
+ context 'security groups' do
+ subject(:groups){ facet.clouds.values.first.security_groups.values }
- its(:length) { should eql 2 }
+ its(:length){ should eq(2) }
it 'authorizes ssh on port 22 from anywhere' do
- ssh_auth = @groups.detect { |g| g.name == 'ssh' }
- ssh_auth.should_not be_nil
+ groups.one?{ |g| g.name == 'ssh' }.should be_true
end
it 'authorizes MySQL on port 3306 from anywhere' do
- mysql_auth = @groups.detect { |g| g.name == 'sparky-mysql' }
+ mysql_auth = groups.detect{ |g| g.name == 'quirky-mysql' }
mysql_auth.should_not be_nil
- mysql_auth.range_authorizations.select { |g| g.eql? [3306..3306, "0.0.0.0/0", "tcp"] }.should_not be_empty
+ mysql_auth.range_authorizations.should include([3306..3306, '0.0.0.0/0', 'tcp'])
end
end
View
7 spec/spec_helper.rb
@@ -14,12 +14,9 @@
Pathname.register_paths(code: File.expand_path('../..', __FILE__),
spec: [:code, 'spec'],
fixtures: [:spec, 'fixtures'],
- support: [:spec, 'support'],
- features: [:spec, 'acceptance'],
- steps: [:features, 'steps'])
+ support: [:spec, 'support'])
Dir[Pathname.path_to(:support).join('**/*.rb')].each{ |f| require f }
-Dir[Pathname.path_to(:steps).join('**/*.rb')].each{ |f| require f }
RSpec.configure do |cfg|
def ironfan_go!
@@ -29,7 +26,7 @@ def ironfan_go!
Chef::Config.instance_eval do
knife.merge!(aws_access_key_id: 'access_key',
aws_secret_access_key: 'secret')
- cluster_path Pathname.path_to(:fixtures).to_s
+ cluster_path Pathname.path_to(:fixtures).join('clusters').to_s
end
Ironfan.ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, {})

No commit comments for this range

Something went wrong with that request. Please try again.