spec/arborist/node_spec.rb in arborist-0.0.1.pre20160829140603 vs spec/arborist/node_spec.rb in arborist-0.0.1.pre20161005112841
- old
+ new
@@ -203,10 +203,17 @@
node.update( ack: {message: "Maintenance", sender: 'mahlon'} )
expect( node ).to be_disabled
end
+ it "transitions to `disabled` from `unknown` status if it's updated with an `ack` property" do
+ node.status = 'unknown'
+ node.update( ack: {message: "Maintenance", sender: 'mahlon'} )
+
+ expect( node ).to be_disabled
+ end
+
it "stays `disabled` if it gets an error" do
node.status = 'up'
node.update( ack: {message: "Maintenance", sender: 'mahlon'} )
node.update( error: "take me to the virus hospital" )
@@ -802,15 +809,27 @@
expect( node.dependencies.behavior ).to eq( :all )
expect( node.dependencies.identifiers ).to include( 'san-iscsi' )
end
- it "can be declared for unrelated identifiers"
- it "can be declared for related identifiers"
+ it "can be declared for all of a group of identifiers" do
+ node.depends_on( 'iscsi', 'memcached', 'ldap', on: 'dmz' )
+ expect( node ).to have_dependencies
+ expect( node.dependencies.behavior ).to eq( :all )
+ expect( node.dependencies.identifiers ).to include( 'dmz-iscsi', 'dmz-memcached', 'dmz-ldap' )
+ end
- it "can be declared for all of a group of identifiers"
- it "can be declared for any of a group of identifiers"
+ it "can be declared for any of a group of identifiers" do
+ node.depends_on( node.any_of('memcached', on: %w[blade1 blade2 blade3]) )
+ expect( node ).to have_dependencies
+ expect( node.dependencies.behavior ).to eq( :all )
+ expect( node.dependencies.subdeps.size ).to eq( 1 )
+ subdep = node.dependencies.subdeps.first
+ expect( subdep.behavior ).to eq( :any )
+ expect( subdep.identifiers ).
+ to include( 'blade1-memcached', 'blade2-memcached', 'blade3-memcached' )
+ end
it "cause the node to be quieted when the dependent node goes down" do
node.depends_on( provider_node.identifier )
node.register_secondary_dependencies( manager )