Skip to content

Commit

Permalink
realms spec passes now with resolve
Browse files Browse the repository at this point in the history
Change-Id: I54340df8167f79479e0a6b382676c8adc7be3cd7
  • Loading branch information
Travis Dempsey committed Mar 6, 2014
1 parent 750ed25 commit ef5e817
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions spec/ironfan/realm_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@
end end
end end


def manifest after(:each) do
Ironfan.cluster(:bar).facets[:baz].server(0).to_machine_manifest Ironfan.clusters.clear
Ironfan.realms.clear
end

def manifest
Ironfan.cluster(:bar).resolve.facets[:baz].server(0).to_machine_manifest
end end


it 'chooses its own name as its default environment' do it 'chooses its own name as its default environment' do
Ironfan.realm(:bar).environment.to_s.should == 'bar' Ironfan.realm(:bar){ }.environment.to_s.should == 'bar'
end end


it 'chooses the widest possible cookbook contraints to satisfy all plugins' do it 'chooses the widest possible cookbook contraints to satisfy all plugins' do
Expand Down Expand Up @@ -112,7 +117,7 @@ def project(_) end
Ironfan.cluster(:bar).facets[:baz].server(0).should_not(be_nil) Ironfan.cluster(:bar).facets[:baz].server(0).should_not(be_nil)
end end


it 'should create clusters with attributes correctly applied' do it 'should create clusters with attributes correctly applied' do
manifest.cluster_override_attributes.should == {a: 1} manifest.cluster_override_attributes.should == {a: 1}
manifest.facet_override_attributes.should == {b: 1} manifest.facet_override_attributes.should == {b: 1}
manifest.run_list.should == %w[role[blah] role[bar-cluster] role[bar-baz-facet]] manifest.run_list.should == %w[role[blah] role[bar-cluster] role[bar-baz-facet]]
Expand All @@ -133,12 +138,12 @@ def project(_) end


it 'should save an environment to be shared among all clusters within the realm' do it 'should save an environment to be shared among all clusters within the realm' do
# We need to resolve before the cloud settings come through # We need to resolve before the cloud settings come through
Ironfan.realm(:foo).clusters[:bar].resolve.facets[:baz].environment.should == :bif Ironfan.realm(:foo).resolve.clusters[:bar].facets[:baz].environment.should == :bif


# The server manifest should contain the environment. # The server manifest should contain the environment.
manifest.environment.should == :bif manifest.environment.should == :bif


# Ironfan.cluster will do the resolution for us. # Ironfan.cluster will do the resolution for us.
Ironfan.cluster(:bar).facets[:baz].environment.should == :bif Ironfan.cluster(:bar).resolve.facets[:baz].environment.should == :bif
end end
end end

0 comments on commit ef5e817

Please sign in to comment.